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