using AccountsBLL.Party; using FastEndpoints; using GB5Shared.DTO.Framework.Logging; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using Newtonsoft.Json; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.Party { public class DeleteParty : BaseEndpoint> { private readonly IPartyBLL _PartyBLL; public DeleteParty(IPartyBLL PartyBLL) { _PartyBLL = PartyBLL; } public override void Configure() { Delete("/Party/DeleteParty"); AllowAnonymous(); } public record DeletePartyParameters( [property: FromHeader] string Login, [property: QueryParam] int PartyId ); protected override async Task> ExecuteAsync(DeletePartyParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PartyBLL.DeleteParty(req.PartyId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.CLIENT_LEVEL, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, LoginDTO, ex.Message, 500); } } } }