using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.NOCList; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.NOCList { public class GetNOCList : BaseEndpoint> { private readonly INOCListBLL _NOCListBLL; public GetNOCList(INOCListBLL nocListBLL) { _NOCListBLL = nocListBLL; } public override void Configure() { Get("/NOCList/GetNOCList"); AllowAnonymous(); } public record GetNOCListParameters( [property: FromHeader] string Login, [property: QueryParam] int NOCListId ); protected override async Task> ExecuteAsync( GetNOCListParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _NOCListBLL.GetNOCList(req.NOCListId, loginDTO); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.USER_LEVEL, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.USER_LEVEL, loginDTO, ex.Message, 500); } } } }