using AccountsBLL.AccountSchedule; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static AccountsSL.EndPoints.BankBranch.GetBankBranch; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.AccountSchedule { public class GetAccountSchedule : BaseEndpoint> { private readonly IAccountScheduleBLL _AccountScheduleBLL; public GetAccountSchedule(IAccountScheduleBLL IAccountScheduleBLL) { _AccountScheduleBLL = IAccountScheduleBLL; } public override void Configure() { Get("/AccountSchedule/GetAccountSchedule"); AllowAnonymous(); } public record GetAccountScheduleParameters( [property: FromHeader] string Login, [property: QueryParam] int AccountScheduleId ); //protected override string? GetCacheKey(GetAccountScheduleParameters Parameters, LoginDTO LoginDTO) //{ // try // { // return KeyGenerator.KeyGeneration(Parameters.AccountScheduleId!, EntityConstant.OBJECTACCOUNTSCHEDULE, CacheKeyLevel.USER_LEVEL, LoginDTO); // } // catch (Exception) // { // throw; // } //} //protected override string? GetCacheKey(GetAccountScheduleParameters req, LoginDTO login) // => KeyGenerator.KeyGeneration(req.AccountScheduleId, EntityConstant.OBJECTACCOUNTSCHEDULE, CacheKeyLevel.USER_LEVEL, login); protected override async Task> ExecuteAsync(GetAccountScheduleParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _AccountScheduleBLL.GetAccountSchedule(req.AccountScheduleId, 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); } } } }