Ship Novya PWA with backend for deployable production use.
Fix production TypeScript builds and add DEPLOY.md so the app can be hosted from this repo. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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 = 18;
|
||||
export const PROFILE_AGE_MAX = 100;
|
||||
|
||||
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}`)
|
||||
.max(PROFILE_AGE_MAX, `Age must be at most ${PROFILE_AGE_MAX}`);
|
||||
|
||||
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>;
|
||||
Reference in New Issue
Block a user