* MED-151: add profile view and working smoking dashboard card * update zod * move some components to shared * move some components to shared * remove console.logs * remove unused password form components * only check null for variant * use pathsconfig
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const UpdateAccountSchema = z.object({
|
|
firstName: z
|
|
.string({
|
|
error: 'First name is required',
|
|
})
|
|
.nonempty(),
|
|
lastName: z
|
|
.string({
|
|
error: 'Last name is required',
|
|
})
|
|
.nonempty(),
|
|
personalCode: z
|
|
.string({
|
|
error: 'Personal code is required',
|
|
})
|
|
.nonempty(),
|
|
email: z.string().email({
|
|
message: 'Email is required',
|
|
}),
|
|
phone: z
|
|
.string({
|
|
error: 'Phone number is required',
|
|
})
|
|
.nonempty(),
|
|
city: z.string().optional(),
|
|
weight: z
|
|
.number({
|
|
error: (issue) =>
|
|
issue.input === undefined
|
|
? 'Weight is required'
|
|
: 'Weight must be a number',
|
|
})
|
|
.gt(0, { message: 'Weight must be greater than 0' }),
|
|
|
|
height: z
|
|
.number({
|
|
error: (issue) =>
|
|
issue.input === undefined
|
|
? 'Height is required'
|
|
: 'Height must be a number',
|
|
})
|
|
.gt(0, { message: 'Height must be greater than 0' }),
|
|
userConsent: z.boolean().refine((val) => val === true, {
|
|
message: 'Must be true',
|
|
}),
|
|
});
|