using AnalyticsBLL.Warehouse; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; namespace AnalyticsSL.EndPoints.Warehouse { public class DeleteFactDimension : BaseEndpoint> { private readonly IWarehouseFactDimensionBLL _bll; public DeleteFactDimension(IWarehouseFactDimensionBLL bll) => _bll = bll; public override void Configure() { Delete("/Warehouse/DeleteFactDimension"); AllowAnonymous(); } public record DeleteFactDimensionParameters( [property: FromHeader] string Login, [property: QueryParam] int FactDimensionId ); protected override string? GetCacheKey(DeleteFactDimensionParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( DeleteFactDimensionParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.DeleteAsync(req.FactDimensionId, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, GB5Shared.GB5Constant.Constant.CacheKeyLevel.NOT_REQUIRED, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, GB5Shared.GB5Constant.Constant.CacheKeyLevel.NOT_REQUIRED, login, ex.Message, 500); } } } }