using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using AdminBLL.IceData; using AdminDAL.DTO.IceData; using static GB5Shared.GB5Constant.Constant; namespace AdminSL.EndPoints.IceData { public class GetIceDataFull : BaseEndpoint { private readonly IIceDataBLL _IceDataBLL; public GetIceDataFull(IIceDataBLL IceDataBLL) { _IceDataBLL = IceDataBLL; } public override void Configure() { Get("/IceData/GetIceDataFull"); AllowAnonymous(); } public record GetIceDataParameters( [property: QueryParam] int IceDataId, [property: FromHeader] string Login ); //protected override string? GetCacheKey(GetIceDataParameters parameters, LoginDTO LoginDTO) //{ // try // { // return KeyGenerator.KeyGeneration(parameters.IceDataId!, EntityConstant.OBJECTICEDATA, CacheKeyLevel.USER_LEVEL, LoginDTO); // } // catch (Exception) // { // throw; // } //} protected override async Task> ExecuteAsync(GetIceDataParameters parameters, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _IceDataBLL.GetIceDataFull(parameters.IceDataId, 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); } } } }