using FastEndpoints; using FrameworkBLL.MetaReport; using FrameworkDAL.DTO.MetaReport; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.MetaReport { // Authoring-level write (MMETAREPORT + its whole aggregate). No [MenuRights]/Roles(...) gate // yet — matches every other Framework/Menu-family endpoint's current AllowAnonymous() // convention; real authorization is a follow-up (same deferral as MenuGroup's). public class SaveMetaReportDefinition : BaseEndpoint> { private readonly IMetaReportBLL _metaReportBLL; public SaveMetaReportDefinition(IMetaReportBLL metaReportBLL) => _metaReportBLL = metaReportBLL; public override void Configure() { Post("/MetaReport/SaveMetaReportDefinition"); AllowAnonymous(); } public record SaveMetaReportDefinitionParameters( [property: FromHeader] string Login, [property: FromBody] MetaReportDTO MetaReportDTO ); protected override string? GetCacheKey(SaveMetaReportDefinitionParameters req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync( SaveMetaReportDefinitionParameters req, LoginDTO loginDTO, CancellationToken ct) { var result = await _metaReportBLL.SaveMetaReportDefinition(req.MetaReportDTO, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } } }