using AccountsBLL.PartyOU; using AccountsDAL.DTO.PartyOU; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.PartyOU { public class SavePartyOU : BaseEndpoint> { private readonly IPartyOUBLL _PartyOUBLL; public SavePartyOU(IPartyOUBLL partyOUBLL) { _PartyOUBLL = partyOUBLL; } public override void Configure() { Post("/PartyOU/SavePartyOU"); AllowAnonymous(); } public record SavePartyOUParameters( [property: FromHeader] string Login, [property: FromBody] PartyOUDTO PartyOUDTO ); protected override async Task> ExecuteAsync(SavePartyOUParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PartyOUBLL.SavePartyOU(req.PartyOUDTO, 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); } } } }