Files
pwa/backend/src/modules/users/users.schemas.ts
T
ar.badieiandCursor c6243caa35 Add read-only Noya admin panel with assignments and UX polish.
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>
2026-09-21 08:00:24 +03:30

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>;