Renames core domain entities and services from "User" to "Account" Refactors project-wide namespaces, classes, and database tables to use "Account" terminology Updates related components, services, and database schema to reflect new domain naming Standardizes naming conventions across authentication and organization setup features
31 lines
967 B
C#
31 lines
967 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using PlanTempus.Core.CommandQueries;
|
|
|
|
namespace PlanTempus.Components.Accounts.Create
|
|
{
|
|
[ApiController]
|
|
[Route("api/accounts")]
|
|
public class CreateAccountController(CreateAccountHandler handler, CreateAccountValidator validator) : ControllerBase
|
|
{
|
|
[HttpPost]
|
|
public async Task<ActionResult<CommandResponse>> Create([FromBody] CreateAccountCommand command)
|
|
{
|
|
try
|
|
{
|
|
var validationResult = await validator.ValidateAsync(command);
|
|
if (!validationResult.IsValid)
|
|
{
|
|
return BadRequest(validationResult.Errors);
|
|
}
|
|
|
|
var result = await handler.Handle(command);
|
|
|
|
return Accepted($"/api/requests/{result.RequestId}", result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return BadRequest(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|