feat: api v1 garden bangs routes and openapi

This commit is contained in:
ginnoir
2026-07-04 19:13:49 -05:00
parent d4304b005c
commit e8d13bede8
16 changed files with 1351 additions and 113 deletions
+13 -2
View File
@@ -14,7 +14,10 @@ export type RecentBangDto = {
recordedByName: string | null;
};
export async function getBangStats(householdId: string, limit: number): Promise<BangStatsDto> {
export async function getBangStatsForScope(
householdId: string,
limit: number,
): Promise<BangStatsDto> {
const [totalRow] = await db
.select({ total: count() })
.from(bangEvents)
@@ -34,6 +37,14 @@ export async function getBangStats(householdId: string, limit: number): Promise<
return {
total: totalRow?.total ?? 0,
recent,
recent: recent.map((r) => ({
id: r.id,
occurredOn: r.occurredOn,
recordedByName: r.recordedByName,
})),
};
}
export async function getBangStats(householdId: string, limit: number): Promise<BangStatsDto> {
return getBangStatsForScope(householdId, limit);
}