feat(dashboard): add reports
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
export * from "./articles";
|
||||
export * from "./auth";
|
||||
export * from "./reports";
|
||||
export * from "./shared";
|
||||
export * from "./sources";
|
||||
export * from "./users";
|
||||
|
||||
@@ -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>;
|
||||
Reference in New Issue
Block a user