import vine from '@vinejs/vine' /** * Shared rules for email and password. */ const email = () => vine.string().email().maxLength(254) const password = () => vine.string().minLength(8).maxLength(72) /** * Validator pour /auth/signup. Contrat aligné sur le SPA (Zod * `registerSchema` dans packages/shared). Pas de passwordConfirmation * côté API : la confirmation visuelle est une affaire de formulaire. */ export const signupValidator = vine.create({ email: email().unique({ table: 'users', column: 'email' }), password: password(), fullName: vine.string().minLength(2).maxLength(120), }) /** * Validator pour /auth/login. */ export const loginValidator = vine.create({ email: email(), password: vine.string(), }) /** * Validator pour /account/profile (PATCH). Tous les champs optionnels. */ export const updateProfileValidator = vine.create({ fullName: vine.string().minLength(2).maxLength(120).optional(), email: email().optional(), signature: vine.string().maxLength(500).optional(), })