using AccountsBLL.AccountReports.DayBook; using AccountsDAL.DTO.AccountsReports; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Report; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.AccountReports { public class GetDayBooks : BaseReportEndpoint { private readonly IDayBookReportBLL _bll; public GetDayBooks(IDayBookReportBLL bll) { _bll = bll; } public override void Configure() { Post("/AccountReports/GetDayBooks"); AllowAnonymous(); } public record GetDayBooksParameter( [property: FromHeader] string Login, [property: FromBody] ReportCallingDTO ReportCallingDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override IAsyncEnumerable ExecuteReportAsync( GetDayBooksParameter req, LoginDTO login, CancellationToken ct) => _bll.GetDayBooksStream(req.FirstNumber, req.MaxResult, req.ReportCallingDTO.CriteriaDTO, login, ct); // UI table path — paged with totals via FirstNumber / MaxResult protected override async Task> ExecutePagedAsync( GetDayBooksParameter req, LoginDTO login, CancellationToken ct) { var result = await _bll.GetDayBooks( req.FirstNumber, req.MaxResult, req.ReportCallingDTO.CriteriaDTO, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } } }