using FastEndpoints; using FrameworkBLL.Project; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.Project { public class DeleteProject : BaseEndpoint> { public readonly IProjectBLL _ProjectBLL; public DeleteProject(IProjectBLL IProjectBLL) { _ProjectBLL = IProjectBLL; } public override void Configure() { Delete("/Project/DeleteProject"); AllowAnonymous(); } public record DeleteProjectParameters( [property: FromHeader] string Login, [property: QueryParam] int ProjectId ); protected override async Task> ExecuteAsync(DeleteProjectParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _ProjectBLL.DeleteProject(req.ProjectId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }