using FastEndpoints; using FrameworkBLL.RoleVsPortlet; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.RoleVsPortlet { public class GetPageForRoleMenu : BaseEndpoint> { private readonly IRoleVsPortletBLL _RoleVsPortletBLL; public GetPageForRoleMenu(IRoleVsPortletBLL RoleVsPortletBLL) { _RoleVsPortletBLL = RoleVsPortletBLL; } public override void Configure() { Post("/RoleVsPortlet/GetPageForRoleMenu"); AllowAnonymous(); } public record GetPageForRoleMenuParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(GetPageForRoleMenuParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _RoleVsPortletBLL.GetPageForRoleMenu(req.CriteriaDTO, 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); } } } }