refactor: to return the result according to the RFC 7807 standard and add a traceId
This commit is contained in:
@ -8,6 +8,7 @@ using Mirea.Api.Dto.Common;
|
||||
using Mirea.Api.Dto.Requests;
|
||||
using Mirea.Api.Dto.Responses;
|
||||
using Mirea.Api.Endpoint.Common.Attributes;
|
||||
using Mirea.Api.Endpoint.Common.Exceptions;
|
||||
using Mirea.Api.Endpoint.Common.MapperDto;
|
||||
using Mirea.Api.Endpoint.Configuration.Model;
|
||||
using System;
|
||||
@ -52,14 +53,10 @@ public class ScheduleController(IMediator mediator, IOptionsSnapshot<GeneralConf
|
||||
(request.Professors == null || request.Professors.Length == 0) &&
|
||||
(request.LectureHalls == null || request.LectureHalls.Length == 0))
|
||||
{
|
||||
return BadRequest(new ErrorResponse()
|
||||
{
|
||||
Error = "At least one of the arguments must be selected."
|
||||
+ (request.IsEven.HasValue
|
||||
? $" \"{nameof(request.IsEven)}\" is not a strong argument"
|
||||
: string.Empty),
|
||||
Code = StatusCodes.Status400BadRequest
|
||||
});
|
||||
throw new ControllerArgumentException("At least one of the arguments must be selected."
|
||||
+ (request.IsEven.HasValue
|
||||
? $" \"{nameof(request.IsEven)}\" is not a strong argument"
|
||||
: string.Empty));
|
||||
}
|
||||
|
||||
var result = (await mediator.Send(new GetScheduleListQuery
|
||||
|
Reference in New Issue
Block a user