using DMSBLL.ESSDocument; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace DMSSL.EndPoints.ESSDocument { public class GetMyDocumentList : BaseEndpoint> { public readonly IESSDocumentBLL _ESSDocumentBLL; public GetMyDocumentList(IESSDocumentBLL essDocumentBLL) { _ESSDocumentBLL = essDocumentBLL; } public record GetMyDocumentListParameters( [property: FromHeader] string Login, [property: QueryParam] string? CategoryCode, [property: QueryParam] int? Year, [property: QueryParam] int? Month ); public override void Configure() { Get("/ESSDocument/GetMyDocumentList"); AllowAnonymous(); } // GetMyDocumentList.cs protected override async Task> ExecuteAsync( GetMyDocumentListParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _ESSDocumentBLL.GetMyDocumentList( req.CategoryCode, req.Year, req.Month, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, loginDTO, ex.Message, 500); } } } }