Complete MVP implementation (Étape 1) covering: - Domain: primitives (Entity<TId>, ValueObject), 10 entities, 6 enums - EF Core: AppDbContext + Identity, 8 EntityTypeConfigurations, audit/soft-delete interceptors, initial migration - Application: service interfaces, DTOs, FluentValidation, ServiceResult pattern - Security: Identity + JWT + API Key multi-auth, role-based permissions, constant-time key validation - API: Auth/Sites/Agents controllers with explicit auth scheme policies - Workers: Hangfire PostgreSQL setup with schema isolation, HeartbeatMonitorJob - Agent: registration service + 30s heartbeat loop - Docker: multi-stage Dockerfiles for central + agent, docker-compose.yml - CI/CD: GitHub Actions pipeline with build+test and Docker build - Tests: 13 domain tests (Site, Agent, Camera entities) Architecture decisions per deliberation council: - API Key via AuthenticationHandler<T> (not middleware) - Explicit [Authorize(AuthenticationSchemes)] on all endpoints - Event/Recording/Person/Vehicle deferred from initial migration - Hangfire compatible with .NET 10 (v1.8.17)
23 lines
549 B
C#
23 lines
549 B
C#
namespace Heimdall.Domain.Entities;
|
|
|
|
/// <summary>
|
|
/// Many-to-many relationship between users and sites.
|
|
/// Determines which sites a non-admin user can access.
|
|
/// </summary>
|
|
public class UserSite
|
|
{
|
|
public Guid UserId { get; private set; }
|
|
public Guid SiteId { get; private set; }
|
|
|
|
public AppUser User { get; private set; } = null!;
|
|
public Site Site { get; private set; } = null!;
|
|
|
|
private UserSite() { } // EF Core
|
|
|
|
public UserSite(Guid userId, Guid siteId)
|
|
{
|
|
UserId = userId;
|
|
SiteId = siteId;
|
|
}
|
|
}
|