first commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { object, string } from 'yup'
|
||||
|
||||
import { phoneNumberRule } from '@/constants/rules/phoneNumberRule'
|
||||
import { nationalCodeRule } from '@/constants/rules/nationalCodeRule'
|
||||
import { passwordRule } from '@/constants/rules/passwordRule'
|
||||
import { passwordConfirmationRule } from '@/constants/rules/passwordConfirmationRule'
|
||||
|
||||
export const rejectionReasonSchema = object().shape({
|
||||
rejectionReason: string().required(),
|
||||
priority: object()
|
||||
.shape({
|
||||
id: string().required().default(null),
|
||||
})
|
||||
.required()
|
||||
.default(null),
|
||||
adminNote: string().notRequired(),
|
||||
})
|
||||
|
||||
const baseUserShape = {
|
||||
roleId: string().required(),
|
||||
firstName: string().required().min(2),
|
||||
lastName: string().required().min(2),
|
||||
phoneNumber: phoneNumberRule,
|
||||
nationalCode: nationalCodeRule,
|
||||
birthDate: string().nullable().notRequired(),
|
||||
maritalStatus: string().nullable().notRequired(),
|
||||
gender: string().nullable().notRequired(),
|
||||
bio: string().nullable().notRequired(),
|
||||
provinceId: string().nullable().notRequired(),
|
||||
cityId: string().nullable().notRequired(),
|
||||
address: string().nullable().notRequired(),
|
||||
}
|
||||
|
||||
export const userAddSchema = object().shape({
|
||||
...baseUserShape,
|
||||
password: passwordRule,
|
||||
passwordConfirmation: passwordConfirmationRule,
|
||||
})
|
||||
|
||||
export const userEditSchema = object().shape(baseUserShape)
|
||||
Reference in New Issue
Block a user