Ship admin auth, user overview, assessments, chats, assignment filters/export, security hardening, and a separate desktop admin shell with clearer assessment answers. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
888 B
TypeScript
31 lines
888 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const NAME_MAX_LENGTH = 100;
|
|
|
|
export const profileNameSchema = z
|
|
.string({ required_error: 'Name is required' })
|
|
.trim()
|
|
.min(1, 'Name cannot be empty')
|
|
.max(NAME_MAX_LENGTH, `Name must be at most ${NAME_MAX_LENGTH} characters`);
|
|
|
|
export const PROFILE_AGE_MIN = 12;
|
|
|
|
export const profileAgeSchema = z
|
|
.number({
|
|
required_error: 'Age is required',
|
|
invalid_type_error: 'Age must be an integer',
|
|
})
|
|
.int('Age must be an integer')
|
|
.min(PROFILE_AGE_MIN, `Age must be at least ${PROFILE_AGE_MIN}`);
|
|
|
|
export const patchProfileSchema = z
|
|
.object({
|
|
name: profileNameSchema.optional(),
|
|
age: profileAgeSchema.optional(),
|
|
})
|
|
.refine((value) => value.name !== undefined || value.age !== undefined, {
|
|
message: 'At least one of name or age is required',
|
|
});
|
|
|
|
export type PatchProfileInput = z.infer<typeof patchProfileSchema>;
|