using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PIEBLL.Variant; using static GB5Shared.GB5Constant.Constant; namespace PIESL.EndPoints.Variant { public class GetPIEVariant : BaseEndpoint> { private readonly IPIEVariantBLL _PIEVariantBLL; public GetPIEVariant(IPIEVariantBLL pieVariantBLL) { _PIEVariantBLL = pieVariantBLL; } public override void Configure() { Get("/PIE/GetPIEVariant"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] Guid VariantId ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => KeyGenerator.KeyGeneration(req.VariantId, EntityConstant.OBJECTPIEVARIANT, CacheKeyLevel.CLIENT_LEVEL, loginDTO); protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _PIEVariantBLL.GetPIEVariantAsync(req.VariantId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } } }