using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MMHead; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MMHead { public class GetLoadMMHead : BaseEndpoint> { private readonly IMMHeadBLL _MMHeadBLL; public GetLoadMMHead(IMMHeadBLL MMHeadBLL) { _MMHeadBLL = MMHeadBLL; } public override void Configure() { Get("/MMHead/GetLoadMMHead"); AllowAnonymous(); } public record GetLoadMMHeadParameters( [property: QueryParam] string DocumentId, [property: QueryParam] string? DetailId, [property: QueryParam] int BizTransactionClassId, [property: QueryParam] int Nature, [property: QueryParam] int StoreId, [property: QueryParam] int? PartyId, [property: FromHeader] string Login ); //protected override string? GetCacheKey(GetLoadMMHeadParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync(GetLoadMMHeadParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _MMHeadBLL.GetLoadMMHead( req.DocumentId, req.DetailId, req.BizTransactionClassId, req.Nature, req.StoreId, req.PartyId, 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); } } } }