feat(api+web): merge REST API and Blazor UI into single process

Previously the API (heimdall-central) and Blazor UI (heimdall-web) ran as
separate containers with the Blazor Server making internal HTTP calls to
the API. This caused the Blazor circuit to disconnect when the API was
unreachable (network error → "Une erreur réseau est survenue").

Now both serve from the same .NET process on the same port:
- All 16 API controllers, ExceptionFilter, and SignalR hubs integrated
  into Heimdall.Web
- JWT auth, CORS, rate limiting configured in the unified Program.cs
- Dockerfile.central entrypoint runs web/Heimdall.Web.dll
- docker-compose simplified: heimdall-central service removed
- CI publishes heimdall-web image instead of heimdall-central

Also fixes timezone validation on Alpine/tzdata-less environments
and enables FluentValidation auto-validation in the API project.
This commit is contained in:
Arnaud Dartois committed 2026-07-20 10:30:01 +00:00
1 parent 892ca88de8
commit 562aabdfc8
30 files changed
+1969 -99

No files matched your search

@@ -0,0 +1,82 @@
using Heimdall.Application.DTOs;
using Heimdall.Application.Services;
using Heimdall.Infrastructure.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
namespace Heimdall.Api.Controllers;
[ApiController]
[Route("api/persons")]
[EnableRateLimiting("Api")]
public class PersonsController : ControllerBase
{
private readonly IPersonService _personService;
public PersonsController(IPersonService personService) => _personService = personService;
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonWrite)]
[HttpPost]
public async Task<IActionResult> Create([FromBody] CreatePersonRequest request, CancellationToken ct)
{
var result = await _personService.CreateAsync(request, ct);
return result.IsSuccess ? Ok(result.Data) : StatusCode(result.StatusCode ?? 400, new { error = result.Error });
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonWrite)]
[HttpPut("{id:guid}")]
public async Task<IActionResult> Update(Guid id, [FromBody] UpdatePersonRequest request, CancellationToken ct)
{
var result = await _personService.UpdateAsync(id, request, ct);
return result.IsSuccess ? Ok(result.Data) : StatusCode(result.StatusCode ?? 404, new { error = result.Error });
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonRead)]
[HttpGet("{id:guid}")]
public async Task<IActionResult> GetById(Guid id, CancellationToken ct)
{
var result = await _personService.GetByIdAsync(id, ct);
return result.IsSuccess ? Ok(result.Data) : StatusCode(result.StatusCode ?? 404, new { error = result.Error });
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonRead)]
[HttpGet]
public async Task<IActionResult> GetAll([FromQuery] string? category, CancellationToken ct)
{
var result = await _personService.GetAllAsync(category, ct);
return Ok(result.Data);
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonWrite)]
[HttpDelete("{id:guid}")]
public async Task<IActionResult> Delete(Guid id, CancellationToken ct)
{
var result = await _personService.DeleteAsync(id, ct);
return result.IsSuccess ? Ok() : StatusCode(result.StatusCode ?? 404, new { error = result.Error });
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonWrite)]
[HttpPost("{personId:guid}/faces")]
public async Task<IActionResult> RegisterFace(Guid personId, [FromBody] RegisterFaceRequest request, CancellationToken ct)
{
var result = await _personService.RegisterFaceAsync(request with { PersonId = personId }, ct);
return result.IsSuccess ? Ok(result.Data) : StatusCode(result.StatusCode ?? 400, new { error = result.Error });
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonRead)]
[HttpGet("{personId:guid}/faces")]
public async Task<IActionResult> GetFaces(Guid personId, CancellationToken ct)
{
var result = await _personService.GetFacesAsync(personId, ct);
return Ok(result.Data);
}
[Authorize(AuthenticationSchemes = "JwtBearer", Policy = AppPermissions.PersonWrite)]
[HttpDelete("faces/{faceId:guid}")]
public async Task<IActionResult> DeleteFace(Guid faceId, CancellationToken ct)
{
var result = await _personService.DeleteFaceAsync(faceId, ct);
return result.IsSuccess ? Ok() : StatusCode(result.StatusCode ?? 404, new { error = result.Error });
}
}