2026-07-16 20:53:56 +00:00
|
|
|
using Heimdall.Domain.Entities;
|
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
|
|
|
|
|
namespace Heimdall.Infrastructure.Data.Configurations;
|
|
|
|
|
|
|
|
|
|
public class AppUserConfiguration : IEntityTypeConfiguration<AppUser>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<AppUser> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("users");
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.DisplayName)
|
|
|
|
|
.HasMaxLength(200)
|
|
|
|
|
.IsRequired();
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.Theme)
|
|
|
|
|
.HasMaxLength(20)
|
|
|
|
|
.HasDefaultValue("Auto");
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.Language)
|
|
|
|
|
.HasMaxLength(10)
|
|
|
|
|
.HasDefaultValue("fr");
|
|
|
|
|
|
|
|
|
|
builder.Property(u => u.CreatedAt)
|
|
|
|
|
.HasDefaultValueSql("NOW()");
|
2026-07-17 19:21:12 +00:00
|
|
|
|
|
|
|
|
builder.Property(u => u.MustChangePassword)
|
|
|
|
|
.HasDefaultValue(false);
|
2026-07-16 20:53:56 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class AppRoleConfiguration : IEntityTypeConfiguration<AppRole>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<AppRole> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("roles");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class IdentityUserRoleConfiguration : IEntityTypeConfiguration<IdentityUserRole<Guid>>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<IdentityUserRole<Guid>> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("user_roles");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class IdentityUserClaimConfiguration : IEntityTypeConfiguration<IdentityUserClaim<Guid>>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<IdentityUserClaim<Guid>> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("user_claims");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class IdentityUserLoginConfiguration : IEntityTypeConfiguration<IdentityUserLogin<Guid>>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<IdentityUserLogin<Guid>> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("user_logins");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class IdentityRoleClaimConfiguration : IEntityTypeConfiguration<IdentityRoleClaim<Guid>>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<IdentityRoleClaim<Guid>> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("role_claims");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class IdentityUserTokenConfiguration : IEntityTypeConfiguration<IdentityUserToken<Guid>>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<IdentityUserToken<Guid>> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("user_tokens");
|
|
|
|
|
}
|
|
|
|
|
}
|