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>
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Purrse.Core.DTOs;
|
|
using Purrse.Core.Interfaces.Services;
|
|
using System.Security.Claims;
|
|
|
|
namespace Purrse.Api.Controllers;
|
|
|
|
[Authorize]
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class LoansController : ControllerBase
|
|
{
|
|
private readonly ILoanService _loanService;
|
|
private Guid UserId => Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)!);
|
|
|
|
public LoansController(ILoanService loanService) => _loanService = loanService;
|
|
|
|
[HttpGet("{accountId}/amortization")]
|
|
public async Task<ActionResult<LoanDetailResponse>> GetLoanDetail(Guid accountId)
|
|
{
|
|
var detail = await _loanService.GetLoanDetailAsync(UserId, accountId);
|
|
return detail == null ? NotFound() : Ok(detail);
|
|
}
|
|
|
|
[HttpPost("{accountId}")]
|
|
public async Task<ActionResult<LoanDetailResponse>> CreateLoanDetail(Guid accountId, CreateLoanDetailRequest request)
|
|
=> Ok(await _loanService.CreateLoanDetailAsync(UserId, accountId, request));
|
|
|
|
[HttpPut("{accountId}")]
|
|
public async Task<ActionResult<LoanDetailResponse>> UpdateLoanDetail(Guid accountId, CreateLoanDetailRequest request)
|
|
=> Ok(await _loanService.UpdateLoanDetailAsync(UserId, accountId, request));
|
|
|
|
[HttpPost("{accountId}/payoff-scenario")]
|
|
public async Task<ActionResult<PayoffScenarioResponse>> PayoffScenario(Guid accountId, PayoffScenarioRequest request)
|
|
=> Ok(await _loanService.CalculatePayoffScenarioAsync(UserId, accountId, request));
|
|
}
|