using FastEndpoints; using FrameworkBLL.ClientDeveloper; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.ClientDeveloper { public class GetClientDeveloper : BaseEndpoint> { private readonly IClientDeveloperBLL _ClientDeveloperBLL; public GetClientDeveloper(IClientDeveloperBLL IClientDeveloperBLL) { _ClientDeveloperBLL = IClientDeveloperBLL; } public override void Configure() { Get("/ClientDeveloper/GetClientDeveloper"); AllowAnonymous(); } public record GetClientDeveloperParameters( [property: FromHeader] string Login, [property: QueryParam] int ClientId ); protected override string? GetCacheKey(GetClientDeveloperParameters Parameters, LoginDTO LoginDTO) { try { return KeyGenerator.KeyGeneration(Parameters.ClientId!, EntityConstant.OBJECTCLIENTDEVELOPER, CacheKeyLevel.USER_LEVEL, LoginDTO); } catch (Exception) { throw; } } protected override async Task> ExecuteAsync(GetClientDeveloperParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _ClientDeveloperBLL.GetClientDeveloper(req.ClientId, 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); } } } }