using AnalyticsBLL.DBJoin; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AnalyticsSL.EndPoints.DBJoin { public class DeleteDBJoin : BaseEndpoint> { private readonly IDBJoinBLL _DBJoinBLL; public DeleteDBJoin(IDBJoinBLL DBJoinBLL) { _DBJoinBLL = DBJoinBLL; } public override void Configure() { Delete("/DBJoin/DeleteDBJoin"); AllowAnonymous(); } public record DeleteDBJoinParameters( [property: FromHeader] string Login, [property: QueryParam] int DBJoinId ); protected override async Task> ExecuteAsync( DeleteDBJoinParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _DBJoinBLL.DeleteDBJoin(req.DBJoinId, 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); } } } }