using FastEndpoints; using FrameworkBLL.Menu; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.Menu { public class GetReportMenuDetailsForMenu : BaseEndpoint> { private readonly IMenuBLL _menuBLL; public GetReportMenuDetailsForMenu(IMenuBLL IMenuBLL) { _menuBLL = IMenuBLL; } public override void Configure() { Get("/Menu/ReportMenuDetailsForMenu"); AllowAnonymous(); } public record ReportMenuDetailsParameters( [property: FromHeader] string Login, [property: QueryParam] int MenuId, [property: QueryParam] int UserId, [property: QueryParam] int IsFromScreen ); //protected override string? GetCacheKey(ReportMenuDetailsParameters MenuDetailParameter, LoginDTO LoginDTO) //{ // try // { // return KeyGenerator.KeyGeneration($"{MenuDetailParameter.MenuId},{MenuDetailParameter.UserId},{MenuDetailParameter.IsFromScreen}", EntityConstant.MENU, CacheKeyLevel.USER_LEVEL, LoginDTO); // } // catch (Exception) // { // throw; // } //} protected override async Task> ExecuteAsync(ReportMenuDetailsParameters MenuDetailParameter, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _menuBLL.GetReportCriteriaForMenu(MenuDetailParameter.UserId,MenuDetailParameter.MenuId,MenuDetailParameter.IsFromScreen,LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }