initial commit

This commit is contained in:
Harivansh Rathi 2024-11-24 20:56:03 -05:00
commit ef9ccf22d3
133 changed files with 20802 additions and 0 deletions

54
schemas/index.ts Normal file
View file

@ -0,0 +1,54 @@
import * as z from 'zod'
// Do not allow spaces in password
const noSpaces = (value: string) => {
if (value.includes(' ')) {
return false
} else {
return true
}
}
export const LoginSchema = z.object({
email: z.string().email(),
password: z
.string()
.min(1, {
message: 'Password is required'
})
.refine(noSpaces, {
message: 'Password cannot contain spaces'
})
})
export const RegisterSchema = z.object({
email: z.string().email(),
password: z
.string()
.min(8, {
message: 'Minimum 8 characters'
})
.refine(noSpaces, {
message: 'Password cannot contain spaces'
}),
name: z.string().min(1, {
message: 'Name is required'
})
})
export const ResetSchema = z.object({
email: z.string().email({
message: 'Email is required'
})
})
export const NewPasswordSchema = z.object({
password: z
.string()
.min(8, {
message: 'Minimum 8 characters'
})
.refine(noSpaces, {
message: 'Password cannot contain spaces'
})
})