bigbuffet-rw/packages/pl-api/lib/entities/admin/cohort.ts
marcin mikołajczak a521c9044d make pl-api compile
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-16 17:03:27 +02:00

21 lines
499 B
TypeScript

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