using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MTR; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MTR { // ───────────────────────────────────────────────────────────────────── // GetMtrList — POST /MTR/GetMtrList // // Filters (all optional): // SearchText — partial match on MTRNO // PartyId — 0 = all parties // ItemId — 0 = all items // ReportStatus — 0 = all statuses; 1=Draft … 5=Revised // PageOffset / PageSize — standard pagination // // Cache: USER_LEVEL — MTR data is user-context sensitive. // ───────────────────────────────────────────────────────────────────── public class GetMtrList : BaseEndpoint> { private readonly IMtrBLL _MtrBLL; public GetMtrList(IMtrBLL mtrBLL) => _MtrBLL = mtrBLL; public override void Configure() { Post("/MTR/GetMtrList"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] string? SearchText, [property: QueryParam] int PartyId, [property: QueryParam] int ItemId, [property: QueryParam] byte ReportStatus, [property: QueryParam] int PageOffset, [property: QueryParam] int PageSize ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => KeyGenerator.KeyGeneration( $"{req.SearchText}|{req.PartyId}|{req.ItemId}|{req.ReportStatus}|{req.PageOffset}|{req.PageSize}", EntityConstant.OBJECTMTR, CacheKeyLevel.USER_LEVEL, loginDTO); protected override async Task> ExecuteAsync( Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _MtrBLL.GetMtrList( req.SearchText, req.PartyId, req.ItemId, req.ReportStatus, req.PageOffset, req.PageSize, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.USER_LEVEL, loginDTO); } } }