using FastEndpoints; using GB5Shared.DTO.Framework.Logging; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using PayRollBLL.Employee; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.Employee { // Route name matches the legacy GB4 Employee.svc/HRMSDashboard endpoint exactly — // MWEBSERVICE -1399992832 is repointed at this route (see the HRMS migration script). // Workflow-pending-approvals widget intentionally omitted — no GB5 Activiti equivalent yet. public class GetHRMSDashboard : BaseEndpoint> { private readonly IEmployeeBLL _EmployeeBLL; public GetHRMSDashboard(IEmployeeBLL IEmployeeBLL) { _EmployeeBLL = IEmployeeBLL; } public override void Configure() { Post("/Employee/GetHRMSDashboard"); // Roles("User") throws 500 here — no host in this repo configures AddAuthentication, // so FastEndpoints has no scheme to challenge against (repo-wide gap, not specific to // this endpoint). AllowAnonymous matches every other endpoint in this SL module today. AllowAnonymous(); } public record GetHRMSDashboardParameters( [property: FromHeader] string Login, [property: FromBody] ReportCallingDTO ReportCallingDTO ); protected override string? GetCacheKey(GetHRMSDashboardParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync(GetHRMSDashboardParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var json = await _EmployeeBLL.GetHRMSDashboard(req.ReportCallingDTO.CriteriaDTO, LoginDTO!, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(json, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }