Skip to content

Commit

Permalink
feat: schema auth
Browse files Browse the repository at this point in the history
  • Loading branch information
masb0ymas committed Feb 12, 2021
1 parent c20d1b4 commit 745a9d6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/controllers/Auth/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as yup from 'yup'

const register = yup
.object()
.shape({
fullName: yup.string().required('fullname is required'),
email: yup.string().email('invalid email').required('email is required'),
phone: yup.string().required('phone is required'),
active: yup.boolean().nullable(),
tokenVerify: yup.string().nullable(),
newPassword: yup
.string()
.min(8, 'at least 8 characters')
.oneOf([yup.ref('confirmNewPassword')], 'passwords are not the same'),
confirmNewPassword: yup
.string()
.min(8, 'at least 8 characters')
.oneOf([yup.ref('newPassword')], 'passwords are not the same'),
})
.required()

const login = yup
.object()
.shape({
email: yup.string().required('email is required'),
password: yup.string().required('password is required'),
})
.required()

export default { register, login }

0 comments on commit 745a9d6

Please sign in to comment.