using FastEndpoints; using FrameworkBLL.LoadTemplate; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.LoadTemplate { public class DeleteLoadTemplate : BaseEndpoint> { public readonly ILoadTemplateBLL _LoadTemplateBLL; public DeleteLoadTemplate(ILoadTemplateBLL ILoadTemplateBLL) { _LoadTemplateBLL = ILoadTemplateBLL; } public override void Configure() { Delete("/LoadTemplate/DeleteLoadTemplate"); AllowAnonymous(); } public record DeleteLoadTemplateParameters( [property: FromHeader] string Login, [property: QueryParam] int LoadTemplateId ); protected override async Task> ExecuteAsync(DeleteLoadTemplateParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _LoadTemplateBLL.DeleteLoadTemplate(req.LoadTemplateId, 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); } } } }