using System.Collections.Generic; using FastEndpoints; using FrameworkBLL.MenuSet; using FrameworkDAL.DTO.MenuSet; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.MenuSet { // Client-admin-level write (MMENUSETDETAIL) — no Roles(...)/AuthSchemes(ClientJwtBearer) // gate yet, same authorization deferral as the MenuGroup endpoints. Every row that sets // MenuGroupId is validated by MenuSetBLL against IMenuGroupBLL.ValidateMenuGroupVisibility. public class SaveMenuSetDetail : BaseEndpoint> { private readonly IMenuSetBLL _menuSetBLL; public SaveMenuSetDetail(IMenuSetBLL menuSetBLL) => _menuSetBLL = menuSetBLL; public override void Configure() { Post("/MenuSet/SaveMenuSetDetail/{MenuSetId}"); AllowAnonymous(); } public record SaveMenuSetDetailParameters( [property: FromHeader] string Login, int MenuSetId, [property: FromBody] List Details ); protected override string? GetCacheKey(SaveMenuSetDetailParameters req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync( SaveMenuSetDetailParameters req, LoginDTO loginDTO, CancellationToken ct) { var result = await _menuSetBLL.SaveMenuSetDetail(req.MenuSetId, req.Details, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } } }