enum for actor type
This commit is contained in:
parent
4ffa9626f3
commit
5e298ce255
|
@ -6,9 +6,15 @@ import { fillRoute } from "./router.js";
|
||||||
|
|
||||||
export const nicknameRegex = /^[a-zA-Z0-9_]+$/;
|
export const nicknameRegex = /^[a-zA-Z0-9_]+$/;
|
||||||
|
|
||||||
|
const ACTOR_TYPES = [
|
||||||
|
"Application",
|
||||||
|
"Service",
|
||||||
|
"Person"
|
||||||
|
] as const;
|
||||||
|
|
||||||
export const zUser = z.object({
|
export const zUser = z.object({
|
||||||
id: z.number().min(0),
|
id: z.number().min(0),
|
||||||
actor_type: z.string().min(1),
|
actor_type: z.enum(ACTOR_TYPES),
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
nickname: z.string().regex(nicknameRegex),
|
nickname: z.string().regex(nicknameRegex),
|
||||||
bio: z.string(),
|
bio: z.string(),
|
||||||
|
|
Loading…
Reference in New Issue