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