dynamic bar count (multiples of 28), header overflow fix, parentId index for faster chain lookups

This commit is contained in:
Meleki committed 2026-02-23 06:32:08 +01:00
1 parent e2c7adab90
commit 59c492c04f
3 files changed
+29 -7

No files matched your search

+8
View File
@@ -15,6 +15,14 @@ var app = builder.Build();
app.UseDefaultFiles();
app.UseStaticFiles();
// Ensure indexes for chain lookups
using (var db = app.Services.GetRequiredService<Func<SqliteConnection>>()())
{
db.Open();
db.Execute("CREATE INDEX IF NOT EXISTS idx_entries_parentId ON entries(json_extract(data, '$.parentId'))");
}
// GET /api/cost-buckets?from=&to=&bucketMinutes=
// Returns N buckets of aggregated cost
app.MapGet("/api/cost-buckets", (Func<SqliteConnection> factory, string from, string to, int bucketMinutes) =>