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:
@@ -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
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user