using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.FnEmployeePayRollInformation; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.FnEmployeePayRollInformation { public class GetFnEmployeePayRollInformation : BaseEndpoint> { private readonly IFnEmployeePayRollInformationBLL _FnEmployeePayRollInformationBLL; public GetFnEmployeePayRollInformation(IFnEmployeePayRollInformationBLL fnEmployeePayRollInformationBLL) { _FnEmployeePayRollInformationBLL = fnEmployeePayRollInformationBLL; } public override void Configure() { Get("/FnEmployeePayRollInformation/GetFnEmployeePayRollInformation"); AllowAnonymous(); } public record GetFnEmployeePayRollInformationParameters( [property: FromHeader] string Login, [property: QueryParam] int Type, [property: QueryParam] int EmployeeId, [property: QueryParam] string PermissionDate ); //protected override string? GetCacheKey(GetFnEmployeePayRollInformationParameters Parameters, LoginDTO loginDTO) //{ // try // { // return KeyGenerator.KeyGeneration( // Parameters.EmployeeId!, // EntityConstant.OBJECTFnEmployeePayRollInformationParameters, // CacheKeyLevel.USER_LEVEL, // loginDTO // ); // } // catch (Exception) // { // throw; // } //} protected override async Task> ExecuteAsync( GetFnEmployeePayRollInformationParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _FnEmployeePayRollInformationBLL .GetFnEmployeePayrollInformation(req.Type,req.EmployeeId,req.PermissionDate, 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); } } } }