Private
Public Access
1
0
Files
Purrse/src/Purrse.Data/Configurations/AccountConfiguration.cs
T
Catherine Renelle 6520ebf221 Initial commit: Purrse personal finance app
Self-hosted, plugin-extensible personal finance manager built with
ASP.NET Core 9.0, Vue 3 + Vuetify 3, and PostgreSQL 17.

Backend (8 .NET projects):
- Core: 19 domain models, 6 enums, 14 DTOs, 12 service interfaces
- Data: EF Core DbContext, 16 entity configurations, category seeder
- API: 14 controllers, 15 services, JWT auth, SignalR, middleware
- Plugins: Abstractions + OFX/CSV/QIF file parsers
- Tests: 28 xUnit tests (fingerprinting, duplicate detection, parsers)

Frontend (Vue 3 + Vuetify 3 + TypeScript):
- 13 views, Pinia stores, Axios API services with JWT interceptors
- Dashboard, accounts, transactions, categories, imports, and more

Deployment:
- Docker Compose (PostgreSQL 17 + .NET API + nginx frontend)
- Auto-migration on startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 08:56:46 -05:00

34 lines
1.2 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Purrse.Core.Models;
namespace Purrse.Data.Configurations;
public class AccountConfiguration : IEntityTypeConfiguration<Account>
{
public void Configure(EntityTypeBuilder<Account> builder)
{
builder.ToTable("accounts");
builder.HasKey(a => a.Id);
builder.Property(a => a.Name).HasMaxLength(200).IsRequired();
builder.Property(a => a.Institution).HasMaxLength(200);
builder.Property(a => a.AccountNumber).HasMaxLength(50);
builder.Property(a => a.Balance).HasPrecision(18, 2);
builder.Property(a => a.CreditLimit).HasPrecision(18, 2);
builder.Property(a => a.InterestRate).HasPrecision(8, 4);
builder.Property(a => a.Notes).HasMaxLength(1000);
builder.HasOne(a => a.User)
.WithMany(u => u.Accounts)
.HasForeignKey(a => a.UserId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasOne(a => a.LoanDetail)
.WithOne(l => l.Account)
.HasForeignKey<LoanDetail>(l => l.AccountId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex(a => a.UserId);
}
}