using FastEndpoints; using FrameworkBLL.MenuSet; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.MenuSet { public class DeleteMenuSet : BaseEndpoint> { private readonly IMenuSetBLL _menuSetBLL; public DeleteMenuSet(IMenuSetBLL menuSetBLL) => _menuSetBLL = menuSetBLL; public override void Configure() { Delete("/MenuSet/DeleteMenuSet"); AllowAnonymous(); } public record DeleteMenuSetParameters( [property: FromHeader] string Login, [property: QueryParam] int MenuSetId ); protected override string? GetCacheKey(DeleteMenuSetParameters req, LoginDTO loginDTO) => null; protected override async Task> ExecuteAsync( DeleteMenuSetParameters req, LoginDTO loginDTO, CancellationToken ct) { var result = await _menuSetBLL.DeleteMenuSet(req.MenuSetId, loginDTO, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, loginDTO); } } }