feat(persons): add person manager with known face registry and CRUD API

This commit is contained in:
Arnaud Dartois committed 2026-07-19 15:28:38 +00:00
1 parent c5728fa810
commit 129a6148f5
15 files changed
+2404 -63

No files matched your search

@@ -0,0 +1,40 @@
using Heimdall.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Heimdall.Infrastructure.Data.Configurations;
public class PersonConfiguration : IEntityTypeConfiguration<Person>
{
public void Configure(EntityTypeBuilder<Person> builder)
{
builder.ToTable("persons");
builder.HasKey(p => p.Id);
builder.Property(p => p.DisplayName)
.HasMaxLength(200)
.IsRequired();
builder.Property(p => p.Notes)
.HasMaxLength(2000);
builder.Property(p => p.PhotoUrl)
.HasMaxLength(2000)
.IsUnicode(false);
builder.Property(p => p.Category)
.HasMaxLength(50)
.IsUnicode(false);
builder.HasIndex(p => p.DisplayName);
builder.HasIndex(p => p.Category);
builder.HasIndex(p => p.IsWatchlisted);
// OwnsMany for KnownFace (stored as JSONB or separate table)
builder.HasMany(p => p.Faces)
.WithOne(f => f.Person)
.HasForeignKey(f => f.PersonId)
.OnDelete(DeleteBehavior.Cascade);
}
}