using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using TMSBLL.Reports.ComplianceCoverageSummary; using TMSDAL.DTO.Reports; using static GB5Shared.GB5Constant.Constant; namespace TMSSL.EndPoints.Reports { public class GetTrainingComplianceCoverageSummary : BaseReportEndpoint { private readonly IComplianceCoverageSummaryBLL _bll; public GetTrainingComplianceCoverageSummary(IComplianceCoverageSummaryBLL bll) { _bll = bll; } public override void Configure() { Post("/TMSReports/GetTrainingComplianceCoverageSummary"); AllowAnonymous(); } public record GetTrainingComplianceCoverageSummaryParameter( [property: FromHeader] string Login, [property: FromBody] ReportCallingDTO ReportCallingDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult, [property: QueryParam] int MenuId ); protected override IAsyncEnumerable ExecuteReportAsync( GetTrainingComplianceCoverageSummaryParameter req, LoginDTO login, CancellationToken ct) => _bll.GetComplianceCoverageSummaryStream( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, req.MenuId, login, ct); protected override async Task> ExecutePagedAsync( GetTrainingComplianceCoverageSummaryParameter req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetComplianceCoverageSummary( req.FirstNumber, req.MaxResult, req.ReportCallingDTO?.CriteriaDTO, req.MenuId, login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } } }