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