Download src/modules/auth/auth.validation.js from moustafa7/gymco: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/spaces/moustafa7/gymco/resolve/main/src/modules/auth/auth.validation.js
- Command line
-
hf download hf://spaces/moustafa7/gymco/src/modules/auth/auth.validation.js
-
curl -L -o auth.validation.js https://huggingface.co/spaces/moustafa7/gymco/resolve/main/src/modules/auth/auth.validation.js
1.8 kB
| import { z } from 'zod'; | |
| const nestedRegister = z.object({ | |
| gym: z.object({ | |
| name: z.string().min(2), | |
| email: z.string().email().optional(), | |
| phone: z.string().min(5).optional(), | |
| address: z.string().optional(), | |
| }), | |
| owner: z.object({ | |
| name: z.string().min(2), | |
| email: z.string().email(), | |
| password: z.string().min(8), | |
| phone: z.string().min(5).optional(), | |
| nationalId: z.string().min(5).optional(), | |
| }), | |
| }); | |
| const flatRegister = z.object({ | |
| ownerName: z.string().min(2), | |
| email: z.string().email(), | |
| password: z.string().min(8), | |
| gymName: z.string().min(2), | |
| gymAddress: z.string().optional(), | |
| gymPhone: z.string().min(5).optional(), | |
| ownerPhone: z.string().min(5).optional(), | |
| ownerNationalId: z.string().min(5).optional(), | |
| }); | |
| export const registerSchema = z.object({ | |
| body: z.union([nestedRegister, flatRegister]), | |
| }); | |
| export const loginSchema = z.object({ | |
| body: z.object({ | |
| email: z.string().email(), | |
| password: z.string().min(1), | |
| }), | |
| }); | |
| export const refreshSchema = z.object({ | |
| body: z.object({ | |
| refreshToken: z.string().min(20), | |
| }), | |
| }); | |
| export const checkEmailSchema = z.object({ | |
| query: z.object({ | |
| email: z.string().email(), | |
| }), | |
| }); | |
| export const forgotPasswordSchema = z.object({ | |
| body: z.object({ | |
| email: z.string().email(), | |
| }), | |
| }); | |
| export const verifyOtpSchema = z.object({ | |
| body: z.object({ | |
| email: z.string().email(), | |
| otp: z.string().regex(/^\d{6}$/), | |
| }), | |
| }); | |
| export const resetPasswordSchema = z.object({ | |
| body: z.object({ | |
| email: z.string().email(), | |
| otp: z.string().regex(/^\d{6}$/), | |
| newPassword: z.string().min(8), | |
| }), | |
| }); | |
| export const changePasswordSchema = z.object({ | |
| body: z.object({ | |
| currentPassword: z.string().min(1), | |
| newPassword: z.string().min(8), | |
| }), | |
| }); | |