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