6520ebf221
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>
34 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|