bigbuffet-rw/packages/pl-api/lib/entities/admin/cohort.ts
marcin mikołajczak 0bed543c20 pl-api: moar blind search and replace
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-14 22:50:34 +02:00

19 lines
501 B
TypeScript

import * as v from 'valibot';
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/} */
const adminCohortSchema = v.object({
period: z.string().datetime({ offset: true }),
frequency: v.picklist(['day', 'month']),
data: v.array(v.object({
date: z.string().datetime({ offset: true }),
rate: v.number(),
value: v.pipe(v.number(), v.integer()),
})),
});
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;
export {
adminCohortSchema,
type AdminCohort,
};