enum for actor type

This commit is contained in:
Moon Man 2024-01-01 07:55:57 -05:00
parent 4ffa9626f3
commit 5e298ce255
1 changed files with 7 additions and 1 deletions

View File

@ -6,9 +6,15 @@ import { fillRoute } from "./router.js";
export const nicknameRegex = /^[a-zA-Z0-9_]+$/;
const ACTOR_TYPES = [
"Application",
"Service",
"Person"
] as const;
export const zUser = z.object({
id: z.number().min(0),
actor_type: z.string().min(1),
actor_type: z.enum(ACTOR_TYPES),
name: z.string().min(1),
nickname: z.string().regex(nicknameRegex),
bio: z.string(),