Private
Public Access
1
0

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>
This commit is contained in:
Catherine Renelle
2026-02-08 08:56:46 -05:00
commit 6520ebf221
169 changed files with 7180 additions and 0 deletions
@@ -0,0 +1,50 @@
using FluentAssertions;
using Purrse.Core.Helpers;
namespace Purrse.Tests.Helpers;
public class StringSimilarityTests
{
[Theory]
[InlineData("WALMART", "WALMART", 1.0)]
[InlineData("WAL-MART STORE #1234", "WALMART", 0.7)]
[InlineData("AMAZON.COM", "AMAZON MARKETPLACE", 0.6)]
public void Calculate_KnownPairs_ReturnsExpectedRange(string s1, string s2, double minExpected)
{
var result = StringSimilarityHelper.Calculate(s1, s2);
result.Should().BeGreaterOrEqualTo(minExpected);
}
[Fact]
public void Calculate_ExactMatch_ReturnsOne()
{
StringSimilarityHelper.Calculate("Test Payee", "Test Payee").Should().Be(1.0);
}
[Fact]
public void Calculate_CaseInsensitive()
{
var result = StringSimilarityHelper.Calculate("walmart", "WALMART");
result.Should().Be(1.0);
}
[Fact]
public void Calculate_EmptyString_ReturnsZero()
{
StringSimilarityHelper.Calculate("", "test").Should().Be(0);
StringSimilarityHelper.Calculate("test", "").Should().Be(0);
}
[Fact]
public void Calculate_NullString_ReturnsZero()
{
StringSimilarityHelper.Calculate(null!, "test").Should().Be(0);
}
[Fact]
public void Calculate_CompletelyDifferent_ReturnsLowScore()
{
var result = StringSimilarityHelper.Calculate("ABCDEF", "ZYXWVU");
result.Should().BeLessThan(0.5);
}
}
@@ -0,0 +1,56 @@
using FluentAssertions;
using Purrse.Core.Helpers;
namespace Purrse.Tests.Helpers;
public class TransactionFingerprintTests
{
[Fact]
public void Generate_SameInputs_ReturnsSameHash()
{
var accountId = Guid.NewGuid();
var date = new DateTime(2024, 1, 15);
var amount = -42.50m;
var fitId = "FIT123";
var hash1 = TransactionFingerprint.Generate(accountId, date, amount, fitId);
var hash2 = TransactionFingerprint.Generate(accountId, date, amount, fitId);
hash1.Should().Be(hash2);
}
[Fact]
public void Generate_DifferentAmounts_ReturnsDifferentHash()
{
var accountId = Guid.NewGuid();
var date = new DateTime(2024, 1, 15);
var hash1 = TransactionFingerprint.Generate(accountId, date, -42.50m, "FIT123");
var hash2 = TransactionFingerprint.Generate(accountId, date, -42.51m, "FIT123");
hash1.Should().NotBe(hash2);
}
[Fact]
public void Generate_NullFitId_StillWorks()
{
var accountId = Guid.NewGuid();
var date = new DateTime(2024, 1, 15);
var hash = TransactionFingerprint.Generate(accountId, date, -42.50m, null);
hash.Should().NotBeNullOrEmpty();
hash.Should().HaveLength(64); // SHA256 hex = 64 chars
}
[Fact]
public void Generate_DifferentAccounts_ReturnsDifferentHash()
{
var date = new DateTime(2024, 1, 15);
var hash1 = TransactionFingerprint.Generate(Guid.NewGuid(), date, -42.50m, null);
var hash2 = TransactionFingerprint.Generate(Guid.NewGuid(), date, -42.50m, null);
hash1.Should().NotBe(hash2);
}
}
+34
View File
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Purrse.Core\Purrse.Core.csproj" />
<ProjectReference Include="..\Purrse.Data\Purrse.Data.csproj" />
<ProjectReference Include="..\Purrse.Api\Purrse.Api.csproj" />
<ProjectReference Include="..\Purrse.Plugins.Abstractions\Purrse.Plugins.Abstractions.csproj" />
<ProjectReference Include="..\Purrse.Plugins.OFX\Purrse.Plugins.OFX.csproj" />
<ProjectReference Include="..\Purrse.Plugins.CSV\Purrse.Plugins.CSV.csproj" />
<ProjectReference Include="..\Purrse.Plugins.QIF\Purrse.Plugins.QIF.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project>
@@ -0,0 +1,118 @@
using FluentAssertions;
using Microsoft.EntityFrameworkCore;
using Purrse.Api.Services;
using Purrse.Core.Enums;
using Purrse.Core.Helpers;
using Purrse.Core.Models;
using Purrse.Data;
namespace Purrse.Tests.Services;
public class DuplicateDetectionServiceTests
{
private PurrseDbContext CreateContext()
{
var options = new DbContextOptionsBuilder<PurrseDbContext>()
.UseInMemoryDatabase(Guid.NewGuid().ToString())
.Options;
return new PurrseDbContext(options);
}
[Fact]
public void CalculateConfidence_ExactMatch_ReturnsHighScore()
{
using var db = CreateContext();
var service = new DuplicateDetectionService(db);
var existing = new Transaction
{
Id = Guid.NewGuid(),
Amount = -42.50m,
Date = new DateTime(2024, 1, 15),
PayeeName = "WALMART STORE #1234",
CheckNumber = "1001"
};
var score = service.CalculateConfidence(existing, new DateTime(2024, 1, 15), -42.50m, "WALMART STORE #1234", null, "1001");
score.Should().BeGreaterOrEqualTo(0.85, "exact match on amount + date + payee + check# should auto-match");
}
[Fact]
public void CalculateConfidence_DifferentAmount_ReturnsLowScore()
{
using var db = CreateContext();
var service = new DuplicateDetectionService(db);
var existing = new Transaction
{
Id = Guid.NewGuid(),
Amount = -42.50m,
Date = new DateTime(2024, 1, 15),
PayeeName = "WALMART"
};
var score = service.CalculateConfidence(existing, new DateTime(2024, 1, 15), -100.00m, "TARGET", null, null);
score.Should().BeLessThan(0.50, "different amount and payee should not match");
}
[Fact]
public void CalculateConfidence_SameAmountDifferentDay_ReturnsMediumScore()
{
using var db = CreateContext();
var service = new DuplicateDetectionService(db);
var existing = new Transaction
{
Id = Guid.NewGuid(),
Amount = -42.50m,
Date = new DateTime(2024, 1, 15),
PayeeName = "WALMART"
};
var score = service.CalculateConfidence(existing, new DateTime(2024, 1, 16), -42.50m, "WALMART", null, null);
// Amount match (0.40) + 1-day date (0.20) + payee match (0.20) = 0.80
score.Should().BeGreaterOrEqualTo(0.50);
}
[Fact]
public async Task FindDuplicateAsync_ExactFingerprint_ReturnsMatch()
{
using var db = CreateContext();
var accountId = Guid.NewGuid();
var date = new DateTime(2024, 1, 15);
var amount = -42.50m;
var fitId = "FIT123";
var fingerprint = TransactionFingerprint.Generate(accountId, date, amount, fitId);
db.Transactions.Add(new Transaction
{
Id = Guid.NewGuid(),
AccountId = accountId,
Date = date,
Amount = amount,
FitId = fitId,
Fingerprint = fingerprint
});
await db.SaveChangesAsync();
var service = new DuplicateDetectionService(db);
var match = await service.FindDuplicateAsync(accountId, date, amount, null, fitId, null);
match.Should().NotBeNull();
match!.Confidence.Should().Be(1.0);
}
[Fact]
public async Task FindDuplicateAsync_NoMatch_ReturnsNull()
{
using var db = CreateContext();
var service = new DuplicateDetectionService(db);
var match = await service.FindDuplicateAsync(Guid.NewGuid(), DateTime.Now, -10m, "TEST", null, null);
match.Should().BeNull();
}
}