forked from ddrilling/AsbCloudServer
Правки по результатам ревью
This commit is contained in:
parent
f11d1b0f2e
commit
445880854f
@ -24,6 +24,11 @@ namespace AsbCloudApp.Data.SAUB
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float DepthStart { get; set; }
|
public float DepthStart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Связанная с drill_test телеметрия
|
||||||
|
/// </summary>
|
||||||
|
public TelemetryDto Telemetry { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Параметры теста
|
/// Параметры теста
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -10,7 +10,7 @@ namespace AsbCloudApp.Exceptions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// название аргумента
|
/// название аргумента
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ParamName { get; } = string.Empty;
|
public string[] ParamsNames { get; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// конструктор
|
/// конструктор
|
||||||
@ -20,7 +20,18 @@ namespace AsbCloudApp.Exceptions
|
|||||||
public ArgumentInvalidException(string paramName, string message)
|
public ArgumentInvalidException(string paramName, string message)
|
||||||
: base(message)
|
: base(message)
|
||||||
{
|
{
|
||||||
ParamName = paramName;
|
ParamsNames = new string[1] { paramName };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paramsNames"></param>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
public ArgumentInvalidException(string[] paramsNames, string message)
|
||||||
|
: base(message)
|
||||||
|
{
|
||||||
|
ParamsNames = paramsNames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using AsbCloudApp.Data.SAUB;
|
using AsbCloudApp.Data.SAUB;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ namespace AsbCloudApp.Repositories
|
|||||||
/// <param name="request">запрос</param>
|
/// <param name="request">запрос</param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DrillTestDto[]> GetAllAsync(int idTelemetry, FileReportRequest request, CancellationToken cancellationToken);
|
Task<IEnumerable<DrillTestDto>> GetAllAsync(int idTelemetry, FileReportRequest request, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить запись drill_test
|
/// Получить запись drill_test
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data.SAUB;
|
using AsbCloudApp.Data.SAUB;
|
||||||
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
@ -6,6 +7,7 @@ using AsbCloudDb.Model;
|
|||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -15,13 +17,15 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
public class DrillTestRepository : IDrillTestRepository
|
public class DrillTestRepository : IDrillTestRepository
|
||||||
{
|
{
|
||||||
private readonly IAsbCloudDbContext db;
|
private readonly IAsbCloudDbContext db;
|
||||||
|
private readonly IWellService wellService;
|
||||||
|
|
||||||
public DrillTestRepository(IAsbCloudDbContext db)
|
public DrillTestRepository(IAsbCloudDbContext db, IWellService wellService)
|
||||||
{
|
{
|
||||||
this.db = db;
|
this.db = db;
|
||||||
|
this.wellService = wellService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DrillTestDto[]> GetAllAsync(int idTelemetry, FileReportRequest request, CancellationToken cancellationToken)
|
public async Task<IEnumerable<DrillTestDto>> GetAllAsync(int idTelemetry, FileReportRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var query = db.DrillTests
|
var query = db.DrillTests
|
||||||
.Where(d => d.IdTelemetry == idTelemetry)
|
.Where(d => d.IdTelemetry == idTelemetry)
|
||||||
@ -29,19 +33,17 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
if (request.GeDate.HasValue)
|
if (request.GeDate.HasValue)
|
||||||
{
|
{
|
||||||
var startDate = new DateTime(request.GeDate.Value.Year, request.GeDate.Value.Month, request.GeDate.Value.Day);
|
var startDateUTC = new DateTimeOffset(request.GeDate.Value.Year, request.GeDate.Value.Month, request.GeDate.Value.Day, 0, 0, 0, TimeSpan.Zero);
|
||||||
DateTimeOffset startDateUTC = DateTime.SpecifyKind(startDate, DateTimeKind.Utc);
|
|
||||||
query = query.Where(q => q.TimeStampStart >= startDateUTC);
|
query = query.Where(q => q.TimeStampStart >= startDateUTC);
|
||||||
}
|
}
|
||||||
if (request.LeDate.HasValue)
|
if (request.LeDate.HasValue)
|
||||||
{
|
{
|
||||||
var finishDate = new DateTime(request.LeDate.Value.Year, request.LeDate.Value.Month, request.LeDate.Value.Day);
|
var finishDateUTC = new DateTimeOffset(request.LeDate.Value.Year, request.LeDate.Value.Month, request.LeDate.Value.Day, 0, 0, 0, TimeSpan.Zero);
|
||||||
DateTimeOffset finishDateUTC = DateTime.SpecifyKind(finishDate, DateTimeKind.Utc);
|
|
||||||
query = query.Where(q => q.TimeStampStart <= finishDateUTC);
|
query = query.Where(q => q.TimeStampStart <= finishDateUTC);
|
||||||
}
|
}
|
||||||
|
|
||||||
var entities = await query.ToListAsync(cancellationToken);
|
var entities = await query.ToListAsync(cancellationToken);
|
||||||
var dtos = entities.Select(e => e.Adapt<DrillTestDto>()).ToArray();
|
var dtos = entities.Select(e => e.Adapt<DrillTestDto>());
|
||||||
|
|
||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
@ -50,14 +52,17 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
public async Task<DrillTestDto> GetAsync(int idTelemetry, int id, CancellationToken cancellationToken)
|
public async Task<DrillTestDto> GetAsync(int idTelemetry, int id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var drillTest = await db.DrillTests
|
var drillTest = await db.DrillTests
|
||||||
.Where(d => d.IdTelemetry == idTelemetry)
|
|
||||||
.Where(d => d.Id == id)
|
.Where(d => d.Id == id)
|
||||||
|
.Include(d => d.Telemetry)
|
||||||
|
.Where(d => d.Telemetry.Id == idTelemetry)
|
||||||
.FirstOrDefaultAsync(cancellationToken);
|
.FirstOrDefaultAsync(cancellationToken);
|
||||||
|
|
||||||
if (drillTest is null)
|
if (drillTest is null)
|
||||||
throw new Exception($"Drill test with id: {id} and idTelemetry: {idTelemetry} does not exist.");
|
throw new ArgumentInvalidException(new string[] { nameof(id), nameof(idTelemetry) }, $"Drill test with id: {id} and idTelemetry: {idTelemetry} does not exist.");
|
||||||
|
|
||||||
var dto = drillTest.Adapt<DrillTestDto>();
|
var dto = drillTest.Adapt<DrillTestDto>();
|
||||||
|
dto.TimeStampStart = dto.TimeStampStart.ToRemoteDateTime(dto.Telemetry.TimeZone?.Hours ?? 0);
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
using AsbCloudApp.Data.DrillTestReport;
|
using AsbCloudApp.Data.DrillTestReport;
|
||||||
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
@ -33,29 +34,25 @@ namespace AsbCloudInfrastructure.Services.DrillTestReport
|
|||||||
|
|
||||||
public async Task<(string fileName, Stream stream)> GenerateAsync(int idWell, int id, CancellationToken cancellationToken)
|
public async Task<(string fileName, Stream stream)> GenerateAsync(int idWell, int id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
|
var well = wellService.GetOrDefault(idWell);
|
||||||
if (telemetry is null)
|
if (well is null)
|
||||||
throw new Exception($"Telemetry with idWell: {idWell} does not exist.");
|
throw new ArgumentInvalidException(nameof(idWell), $"Well with id: {idWell} does not exist.");
|
||||||
|
if (well.IdTelemetry is null)
|
||||||
var dto = await drillTestRepository.GetAsync(telemetry.Id, id, cancellationToken);
|
throw new ArgumentInvalidException(nameof(well.IdTelemetry), $"Well with id: {idWell} does not have telemetry.");
|
||||||
|
|
||||||
var timezone = telemetryService.GetTimezone(telemetry.Id);
|
|
||||||
var remoteDateTime = dto.TimeStampStart.ToRemoteDateTime(timezone.Hours);
|
|
||||||
dto.TimeStampStart = remoteDateTime;
|
|
||||||
|
|
||||||
var cluster = telemetry.Info?.Cluster ?? "-";
|
|
||||||
var deposit = telemetry.Info?.Deposit ?? "-";
|
|
||||||
var wellCaption = wellService.GetOrDefault(idWell)!.Caption ?? "-";
|
|
||||||
|
|
||||||
|
|
||||||
|
var dto = await drillTestRepository.GetAsync(well.IdTelemetry.Value, id, cancellationToken);
|
||||||
|
|
||||||
var report = new DrillTestReportDataDto()
|
var report = new DrillTestReportDataDto()
|
||||||
{
|
{
|
||||||
Data = dto,
|
Data = dto,
|
||||||
Caption = string.Format("Месторождение: {0}, куст: {1}, скважина: {2}", deposit, cluster, wellCaption),
|
Caption = string.Format("Месторождение: {0}, куст: {1}, скважина: {2}",
|
||||||
|
well.Deposit ?? "-",
|
||||||
|
well.Cluster ?? "-",
|
||||||
|
well.Caption ?? "-"),
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
|
||||||
var fileName = string.Format("Drill_test_{0}.xlsx", remoteDateTime.ToString("dd.mm.yyyy_HH_MM_ss"));
|
var fileName = string.Format("Drill_test_{0}.xlsx", dto.TimeStampStart.ToString("dd.mm.yyyy_HH_MM_ss"));
|
||||||
var stream = await drillTestReportMakerService.MakeReportAsync(report, cancellationToken);
|
var stream = await drillTestReportMakerService.MakeReportAsync(report, cancellationToken);
|
||||||
|
|
||||||
return (fileName, stream);
|
return (fileName, stream);
|
||||||
|
@ -92,7 +92,7 @@ internal static class XLExtentions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal static IXLCell _SetValue(this IXLCell cell, DateTime value, string dateFormat = "DD.MM.YYYY HH:MM:SS", bool? setAllBorders = true)
|
internal static IXLCell _SetValue(this IXLCell cell, DateTime value, string dateFormat = "DD.MM.YYYY HH:MM:SS", bool setAllBorders = true)
|
||||||
{
|
{
|
||||||
cell.Value = value;
|
cell.Value = value;
|
||||||
if (setAllBorders == true)
|
if (setAllBorders == true)
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
using AsbCloudApp.Data.DrillTestReport;
|
||||||
|
using AsbCloudApp.Data.SAUB;
|
||||||
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
|
using AsbCloudWebApi.SignalR;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -16,18 +21,60 @@ namespace AsbCloudWebApi.Controllers;
|
|||||||
/// Контроллер для drill_test отчётов
|
/// Контроллер для drill_test отчётов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/well/{idWell}/[controller]")]
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class DrillTestReportController : ControllerBase
|
public class DrillTestController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly IDrillTestReportService drillTestReportService;
|
private readonly IDrillTestReportService drillTestReportService;
|
||||||
|
private readonly IDrillTestRepository drillTestRepository;
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
|
private readonly ITelemetryService telemetryService;
|
||||||
|
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
||||||
|
|
||||||
public DrillTestReportController(IDrillTestReportService drillTestReportService,
|
public string SignalRMethodGetDataName { get; protected set; } = "ReceiveDrilltestData";
|
||||||
IWellService wellService)
|
|
||||||
|
public DrillTestController(
|
||||||
|
IDrillTestReportService drillTestReportService,
|
||||||
|
IDrillTestRepository drillTestRepository,
|
||||||
|
IWellService wellService,
|
||||||
|
ITelemetryService telemetryService,
|
||||||
|
IHubContext<TelemetryHub> telemetryHubContext)
|
||||||
{
|
{
|
||||||
this.drillTestReportService = drillTestReportService;
|
this.drillTestReportService = drillTestReportService;
|
||||||
|
this.drillTestRepository = drillTestRepository;
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
|
this.telemetryService = telemetryService;
|
||||||
|
this.telemetryHubContext = telemetryHubContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Метод получения данных drill_test и drill_test_params от панели оператора.
|
||||||
|
/// Сохраняет в БД.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uid">уникальный идентификатор записи drill_test</param>
|
||||||
|
/// <param name="dto">запись drill test</param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("api/telemetry/{uid}/[controller]")]
|
||||||
|
public async Task<IActionResult> PostDataAsync(
|
||||||
|
string uid,
|
||||||
|
[FromBody] DrillTestDto dto,
|
||||||
|
CancellationToken token)
|
||||||
|
{
|
||||||
|
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
|
||||||
|
if (telemetry is null)
|
||||||
|
throw new Exception($"Telemetry with RemoteUid: {uid} does not exist.");
|
||||||
|
|
||||||
|
await drillTestRepository.SaveDataAsync(telemetry.Id, dto, token);
|
||||||
|
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
||||||
|
if (idWell is not null)
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
var clients = telemetryHubContext.Clients.Group($"well_{idWell}");
|
||||||
|
await clients.SendAsync(SignalRMethodGetDataName, dto);
|
||||||
|
}, CancellationToken.None);
|
||||||
|
|
||||||
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -37,7 +84,7 @@ public class DrillTestReportController : ControllerBase
|
|||||||
/// <param name="id">Ключ entity test записи</param>
|
/// <param name="id">Ключ entity test записи</param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet("api/well/{idWell}/[controller]")]
|
||||||
[Permission]
|
[Permission]
|
||||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")]
|
[ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
@ -60,9 +107,9 @@ public class DrillTestReportController : ControllerBase
|
|||||||
/// <param name="request">Параметры запроса</param>
|
/// <param name="request">Параметры запроса</param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("all")]
|
[HttpGet("api/well/{idWell}/[controller]/all")]
|
||||||
[Permission]
|
[Permission]
|
||||||
[ProducesResponseType(typeof(PaginationContainer<AutoGeneratedDailyReportInfoDto>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(PaginationContainer<DrillTestReportInfoDto>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetListAsync([FromRoute][Required] int idWell,
|
public async Task<IActionResult> GetListAsync([FromRoute][Required] int idWell,
|
||||||
[FromQuery] FileReportRequest request,
|
[FromQuery] FileReportRequest request,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
@ -1,69 +0,0 @@
|
|||||||
using AsbCloudApp.Data.SAUB;
|
|
||||||
using AsbCloudApp.Repositories;
|
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using AsbCloudWebApi.SignalR;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.SignalR;
|
|
||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers.SAUB
|
|
||||||
{
|
|
||||||
|
|
||||||
[Route("api/telemetry")]
|
|
||||||
[ApiController]
|
|
||||||
public class DrillTestController : ControllerBase
|
|
||||||
|
|
||||||
{
|
|
||||||
protected readonly IWellService wellService;
|
|
||||||
private readonly ITelemetryService telemetryService;
|
|
||||||
private readonly IDrillTestRepository drillTestRepository;
|
|
||||||
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
|
||||||
|
|
||||||
public string SignalRMethodGetDataName { get; protected set; } = "ReceiveDrilltestData";
|
|
||||||
|
|
||||||
public DrillTestController(
|
|
||||||
ITelemetryService telemetryService,
|
|
||||||
IDrillTestRepository drillTestRepository,
|
|
||||||
IWellService wellService,
|
|
||||||
IHubContext<TelemetryHub> telemetryHubContext)
|
|
||||||
{
|
|
||||||
this.telemetryService = telemetryService;
|
|
||||||
this.drillTestRepository = drillTestRepository;
|
|
||||||
this.wellService = wellService;
|
|
||||||
this.telemetryHubContext = telemetryHubContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Метод получения данных drill_test и drill_test_params от панели оператора.
|
|
||||||
/// Сохраняет в БД.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uid">уникальный идентификатор записи drill_test</param>
|
|
||||||
/// <param name="dto">запись drill test</param>
|
|
||||||
/// <param name="token"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("{uid}/[controller]")]
|
|
||||||
public async Task<IActionResult> PostDataAsync(
|
|
||||||
string uid,
|
|
||||||
[FromBody] DrillTestDto dto,
|
|
||||||
CancellationToken token)
|
|
||||||
{
|
|
||||||
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
|
|
||||||
if (telemetry is null)
|
|
||||||
throw new Exception($"Telemetry with RemoteUid: {uid} does not exist.");
|
|
||||||
|
|
||||||
await drillTestRepository.SaveDataAsync(telemetry.Id, dto, token);
|
|
||||||
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
|
||||||
if (idWell is not null)
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
var clients = telemetryHubContext.Clients.Group($"well_{idWell}");
|
|
||||||
await clients.SendAsync(SignalRMethodGetDataName, dto);
|
|
||||||
}, CancellationToken.None);
|
|
||||||
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -56,8 +56,8 @@ namespace AsbCloudWebApi.Middlewares
|
|||||||
|
|
||||||
private static string MakeJsonBody(ArgumentInvalidException ex)
|
private static string MakeJsonBody(ArgumentInvalidException ex)
|
||||||
{
|
{
|
||||||
var errors = new Dictionary<string, string[]> {
|
var errors = new Dictionary<string, string[]>() {
|
||||||
{ ex.ParamName, new[]{ ex.Message } }
|
{ string.Join(", ", ex.ParamsNames), new[]{ ex.Message } }
|
||||||
};
|
};
|
||||||
var problem = new ValidationProblemDetails(errors);
|
var problem = new ValidationProblemDetails(errors);
|
||||||
var buffer = System.Text.Json.JsonSerializer.Serialize(problem);
|
var buffer = System.Text.Json.JsonSerializer.Serialize(problem);
|
||||||
|
Loading…
Reference in New Issue
Block a user