24 lines
676 B
TypeScript
24 lines
676 B
TypeScript
/**
|
|
* @ai-summary Request validation schemas for auth API
|
|
* @ai-context Uses Zod for runtime validation and type safety
|
|
*/
|
|
|
|
import { z } from 'zod';
|
|
|
|
// Password requirements:
|
|
// - Minimum 8 characters
|
|
// - At least one uppercase letter
|
|
// - At least one number
|
|
const passwordSchema = z
|
|
.string()
|
|
.min(8, 'Password must be at least 8 characters long')
|
|
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
|
|
.regex(/[0-9]/, 'Password must contain at least one number');
|
|
|
|
export const signupSchema = z.object({
|
|
email: z.string().email('Invalid email format'),
|
|
password: passwordSchema,
|
|
});
|
|
|
|
export type SignupInput = z.infer<typeof signupSchema>;
|