Account profile

💥 Merge migrations
This commit is contained in:
2025-04-14 22:36:41 +08:00
parent 8704305f5a
commit 4512f47299
14 changed files with 578 additions and 1226 deletions

View File

@ -18,6 +18,7 @@ public class AppDatabase(
) : DbContext(options)
{
public DbSet<Account.Account> Accounts { get; set; }
public DbSet<Account.Profile> AccountProfiles { get; set; }
public DbSet<Account.AccountContact> AccountContacts { get; set; }
public DbSet<Account.AccountAuthFactor> AccountAuthFactors { get; set; }
public DbSet<Auth.Session> AuthSessions { get; set; }
@ -42,6 +43,11 @@ public class AppDatabase(
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Account.Account>()
.HasOne(a => a.Profile)
.WithOne(p => p.Account)
.HasForeignKey<Account.Profile>(p => p.Id);
// Automatically apply soft-delete filter to all entities inheriting BaseModel
foreach (var entityType in modelBuilder.Model.GetEntityTypes())