feat(api): add controller infrastructure, Swagger, remove inline /api/audit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-20 20:30:49 -04:00
parent 2a75c9550e
commit 768b5e015e
2 changed files with 11 additions and 14 deletions
+1
View File
@@ -26,6 +26,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.7" />
</ItemGroup>
<ItemGroup>
+10 -14
View File
@@ -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<IReceiptParseQueue, ReceiptParseQueue>();
builder.Services.AddHostedService<ReceiptParseWorkerService>();
@@ -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();