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