From 768b5e015e906298d980689f2cde2bd31cfeb1b7 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Mon, 20 Apr 2026 20:30:49 -0400 Subject: [PATCH] feat(api): add controller infrastructure, Swagger, remove inline /api/audit Co-Authored-By: Claude Opus 4.6 --- MoneyMap/MoneyMap.csproj | 1 + MoneyMap/Program.cs | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/MoneyMap/MoneyMap.csproj b/MoneyMap/MoneyMap.csproj index 5bf1c27..be2d1a7 100644 --- a/MoneyMap/MoneyMap.csproj +++ b/MoneyMap/MoneyMap.csproj @@ -26,6 +26,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/MoneyMap/Program.cs b/MoneyMap/Program.cs index 6c61c38..bc0c3c7 100644 --- a/MoneyMap/Program.cs +++ b/MoneyMap/Program.cs @@ -27,6 +27,10 @@ builder.Services.AddSession(options => builder.Services.AddRazorPages() .AddSessionStateTempDataProvider(); +builder.Services.AddControllers(); +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + // Receipt parse queue and background worker builder.Services.AddSingleton(); builder.Services.AddHostedService(); @@ -70,21 +74,13 @@ app.UseSession(); app.UseAuthorization(); -app.MapRazorPages(); - -// Financial Audit API endpoint -app.MapGet("/api/audit", async ( - IFinancialAuditService auditService, - DateTime? startDate, - DateTime? endDate, - bool includeTransactions = false) => +if (app.Environment.IsDevelopment()) { - var end = endDate ?? DateTime.Today; - var start = startDate ?? end.AddDays(-90); + app.UseSwagger(); + app.UseSwaggerUI(); +} - var result = await auditService.GenerateAuditAsync(start, end, includeTransactions); - return Results.Ok(result); -}) -.WithName("GetFinancialAudit"); +app.MapRazorPages(); +app.MapControllers(); app.Run();