using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.GateEntry; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.GateEntry { public class DeleteGateEntry : BaseEndpoint> { private readonly IGateEntryBLL _GateEntryBLL; public DeleteGateEntry(IGateEntryBLL GateEntryBLL) { _GateEntryBLL = GateEntryBLL; } public override void Configure() { Delete("/GateEntry/DeleteGateEntry"); AllowAnonymous(); } public record DeleteGateEntryParameters( [property: FromHeader] string Login, [property: QueryParam] int GateEntryId ); protected override async Task> ExecuteAsync(DeleteGateEntryParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _GateEntryBLL.DeleteGateEntry(req.GateEntryId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }