bigbuffet-rw/packages/pl-api/lib/entities/admin/measure.ts
marcin mikołajczak 036fa32cd3 Add pl-api to workspace
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-28 13:43:23 +02:00

21 lines
578 B
TypeScript

import { z } from 'zod';
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Measure/} */
const adminMeasureSchema = z.object({
key: z.string(),
unit: z.string().nullable().catch(null),
total: z.coerce.number(),
human_value: z.string().optional().catch(undefined),
previous_total: z.coerce.string().optional().catch(undefined),
data: z.array(z.object({
date: z.string().datetime({ offset: true }),
value: z.coerce.string(),
})),
});
type AdminMeasure = z.infer<typeof adminMeasureSchema>;
export {
adminMeasureSchema,
type AdminMeasure,
};