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