Public Access
- Created adminApi.ts for admin-related operations including user management and site settings. - Developed authApi.ts for authentication processes such as registration, login, and profile management. - Added examApi.ts for handling exam CRUD operations. - Introduced resultApi.ts for managing results submission and retrieval. - Established setupApi.ts for initial setup processes and status checks. - Created ErrorBoundary component to handle rendering errors gracefully in the frontend. - Re-exported shared API utilities in index.ts for easier access.
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
export const registerSchema = z.object({
|
|
email: z.string().email().max(255),
|
|
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
displayName: z.string().min(1, 'Display name is required').max(100),
|
|
})
|
|
|
|
export const loginSchema = z.object({
|
|
email: z.string().email(),
|
|
password: z.string(),
|
|
})
|
|
|
|
export const verifyEmailSchema = z.object({
|
|
token: z.string().min(1, 'Token is required'),
|
|
})
|
|
|
|
export const resetPasswordSchema = z.object({
|
|
token: z.string().min(1, 'Token is required'),
|
|
newPassword: z.string().min(8, 'Password must be at least 8 characters'),
|
|
})
|
|
|
|
export const updateProfileSchema = z.object({
|
|
displayName: z.string().min(1, 'Display name is required').max(100),
|
|
})
|
|
|
|
export const changePasswordSchema = z.object({
|
|
currentPassword: z.string(),
|
|
newPassword: z.string().min(8, 'Password must be at least 8 characters'),
|
|
})
|
|
|
|
export const forgotPasswordSchema = z.object({
|
|
email: z.string().email().optional(),
|
|
})
|
|
|
|
export type RegisterInput = z.infer<typeof registerSchema>
|
|
export type LoginInput = z.infer<typeof loginSchema>
|
|
export type VerifyEmailInput = z.infer<typeof verifyEmailSchema>
|
|
export type ResetPasswordInput = z.infer<typeof resetPasswordSchema>
|
|
export type UpdateProfileInput = z.infer<typeof updateProfileSchema>
|
|
export type ChangePasswordInput = z.infer<typeof changePasswordSchema>
|