using EntitlementBLL.Legal; using FastEndpoints; using GB5Shared.Authorization; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace EntitlementSL.Endpoints.Legal; [MenuRights("entagree", RightOperation.Update)] public class PublishAgreementVersion : BaseEndpoint> { private readonly IAgreementAuthoringBLL _AuthoringBLL; public PublishAgreementVersion(IAgreementAuthoringBLL authoringBLL) => _AuthoringBLL = authoringBLL; public override void Configure() { Post("/Legal/PublishAgreementVersion"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: QueryParam] int AgreementVersionId ); protected override string? GetCacheKey(Params req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync(Params req, LoginDTO loginDTO, CancellationToken ct) { await _AuthoringBLL.PublishVersionAsync(req.AgreementVersionId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse("Published.", CacheKeyLevel.NOT_REQUIRED, loginDTO); } }