using System; using System.Threading; using System.Threading.Tasks; using FastEndpoints; using FrameworkBLL.SysJobShare; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.SysJobShare { public class DeleteSysJobShare : BaseEndpoint> { private readonly ISysJobShareBLL _SysJobShareBLL; public DeleteSysJobShare(ISysJobShareBLL sysJobShareBLL) { _SysJobShareBLL = sysJobShareBLL; } public override void Configure() { Delete("/SysJobShare/DeleteSysJobShare"); AllowAnonymous(); } public record DeleteSysJobShareParameters( [property: FromHeader] string Login, [property: QueryParam] int SysJobShareId ); protected override async Task> ExecuteAsync(DeleteSysJobShareParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _SysJobShareBLL.DeleteSysJobShare(req.SysJobShareId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }