refactor: centralize configuration

This commit is contained in:
2025-11-23 19:54:32 +02:00
parent 57a8501c88
commit 72dfa53f80
78 changed files with 2252 additions and 1385 deletions
+11 -24
View File
@@ -1,30 +1,17 @@
import { z } from "@hono/zod-openapi";
import z from "zod";
import { deltaSchema } from "#domain/models/shared";
import { deltaSchema } from "./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 overviewMetricSchema = z.object({
delta: deltaSchema,
total: z.number().int().nonnegative(),
});
export const dashboardOverviewSchema = z
.object({
articles: overviewMetricSchema,
sources: overviewMetricSchema,
users: overviewMetricSchema,
})
.openapi({
description: "Dashboard overview metrics for key entities.",
});
export const dashboardOverviewSchema = z.object({
articles: overviewMetricSchema,
sources: overviewMetricSchema,
users: overviewMetricSchema,
});
export type OverviewMetric = z.infer<typeof overviewMetricSchema>;
export type DashboardOverview = z.infer<typeof dashboardOverviewSchema>;