using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.StockAccountPost; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.StockValuation { public class GetNonStockPostingReconciliation : BaseEndpoint> { private readonly IStockAccountPostBLL _bll; public GetNonStockPostingReconciliation(IStockAccountPostBLL bll) { _bll = bll; } public override void Configure() { Get("/StockValuation/GetNonStockPostingReconciliation"); AllowAnonymous(); } public record GetNonStockPostingReconciliationParameters( [property: FromHeader] string Login, [property: QueryParam] int ObjectTypeId, [property: QueryParam] int ObjectId, [property: QueryParam] int OUID ); protected override string? GetCacheKey(GetNonStockPostingReconciliationParameters Parameters, LoginDTO LoginDTO) => null; protected override async Task> ExecuteAsync( GetNonStockPostingReconciliationParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _bll.GetPostingReconciliationAsync( req.ObjectTypeId, req.ObjectId, req.OUID, 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); } } } }