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