Files
pwa/backend/src/modules/auth/auth.schemas.ts
T

28 lines
685 B
TypeScript
Raw Normal View History

import { z } from 'zod';
export const emailSchema = z
.string()
.trim()
.min(1, 'Email is required')
.email('Invalid email')
.max(191)
.transform((value) => value.toLowerCase());
export const passwordSchema = z
.string()
.min(8, 'Password must be at least 8 characters')
.max(128, 'Password must be at most 128 characters');
export const registerSchema = z.object({
email: emailSchema,
password: passwordSchema,
});
export const loginSchema = z.object({
email: emailSchema,
password: z.string().min(1, 'Password is required').max(128),
});
export type RegisterInput = z.infer<typeof registerSchema>;
export type LoginInput = z.infer<typeof loginSchema>;