Presentation 2

This commit is contained in:
2026-02-08 20:17:01 +01:00
parent 41793f00c1
commit 70a1cf1544
17 changed files with 681 additions and 113 deletions

View File

@@ -1,5 +1,6 @@
using AipsCore.Application.Abstract;
using AipsCore.Application.Models.User.Command.CreateUser;
using AipsCore.Domain.Common.Validation;
using AipsCore.Domain.Models.User.ValueObjects;
using Microsoft.AspNetCore.Mvc;
@@ -12,8 +13,14 @@ public class UserController : ControllerBase
[HttpPost]
public async Task<ActionResult<int>> CreateUser(CreateUserCommand command, IDispatcher dispatcher, CancellationToken cancellationToken)
{
var userId = await dispatcher.Execute<UserId>(command, cancellationToken);
return Ok(userId.IdValue);
try
{
var userId = await dispatcher.Execute(command, cancellationToken);
return Ok(userId.IdValue);
}
catch (ValidationException validationException)
{
return BadRequest(validationException.ValidationErrors);
}
}
}