using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.PayRevision; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.Endpoints.PayRevision { public class GetPayRevision : BaseEndpoint { private readonly IPayRevisionBLL _PayRevisionBLL; public GetPayRevision(IPayRevisionBLL PayRevisionBLL) { _PayRevisionBLL = PayRevisionBLL; } public override void Configure() { Get("/PayRevision/GetPayRevision"); AllowAnonymous(); } public record GetPayRevisionParameters( [property: QueryParam] int PayRevisionId, [property: FromHeader] string Login ); //protected override string? GetCacheKey(GetPayRevisionParameters GetPayRevisionParameters, LoginDTO LoginDTO) //{ // try // { // return KeyGenerator.KeyGeneration( // GetPayRevisionParameters.PayRevisionId.ToString(), // EntityConstant.OBJECTPAYREVISION, // CacheKeyLevel.CLIENT_LEVEL, // LoginDTO); // } // catch (Exception) // { // throw; // } //} protected override async Task> ExecuteAsync(GetPayRevisionParameters parameters, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _PayRevisionBLL.GetPayRevision(parameters.PayRevisionId, loginDTO!, ct); 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); } } } }