using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using IceImportBLL.IceImportRun; using IceImportSL.Parameters.Run; using static GB5Shared.GB5Constant.Constant; namespace IceImportSL.Endpoints.Run; public class GetImportRunRowErrors : BaseEndpoint> { private readonly IIceImportRunBLL _runBll; public GetImportRunRowErrors(IIceImportRunBLL runBll) => _runBll = runBll; public override void Configure() { Get("/IceImport/GetImportRunRowErrors"); AllowAnonymous(); } protected override string? GetCacheKey(GetImportRunRowErrorsParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( GetImportRunRowErrorsParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _runBll .GetRowErrorsAsync(req.RunId, req.Status, req.Page, req.PageSize, login, ct) .ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NOT_REQUIRED, login, ex.Message, 500); } } }