feat(dashboard): add reports

This commit is contained in:
2025-11-18 13:48:34 +02:00
parent dbcd1d7485
commit 126505fc88
32 changed files with 553 additions and 170 deletions
+1
View File
@@ -1,5 +1,6 @@
export * from "./articles";
export * from "./auth";
export * from "./reports";
export * from "./shared";
export * from "./sources";
export * from "./users";
+30
View File
@@ -0,0 +1,30 @@
import { z } from "@hono/zod-openapi";
import { deltaSchema } from "#domain/models/shared";
export const overviewMetricSchema = z
.object({
delta: deltaSchema.openapi({
description: "Change measured over the last 30 days compared to the previous 30-day window.",
}),
total: z.number().int().nonnegative().openapi({
description: "Total count across the entire dataset.",
example: 12584,
}),
})
.openapi({
description: "Aggregated metric with total count and delta metadata.",
});
export const dashboardOverviewSchema = z
.object({
articles: overviewMetricSchema,
sources: overviewMetricSchema,
users: overviewMetricSchema,
})
.openapi({
description: "Dashboard overview metrics for key entities.",
});
export type OverviewMetric = z.infer<typeof overviewMetricSchema>;
export type DashboardOverview = z.infer<typeof dashboardOverviewSchema>;