feat(infra): add modeling to dbcontext for balance model with migrations

This commit is contained in:
Stevan Freeborn
2026-02-14 06:46:05 -06:00
parent e331030bb0
commit ed7e25961c
4 changed files with 466 additions and 4 deletions
+12
View File
@@ -124,6 +124,11 @@ public sealed class AppDbContext(
.WithOne()
.HasForeignKey<AccountMetadata>(static m => m.AccountId)
.OnDelete(DeleteBehavior.Cascade);
eb.HasMany(static a => a.Balances)
.WithOne()
.HasForeignKey(static b => b.AccountId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<AccountMetadata>(static eb =>
@@ -142,5 +147,12 @@ public sealed class AppDbContext(
eb.Property(static m => m.PlaidId);
eb.Property(static m => m.PlaidName);
});
modelBuilder.Entity<Balance>(static eb =>
{
eb.Property(static b => b.AccountId);
eb.Property(static b => b.Current);
eb.Property(static b => b.Available);
});
}
}