40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import { object, string } from 'yup'
|
|
import { passwordRule } from '@/constants/rules/passwordRule'
|
|
import { phoneNumberRule } from '@/constants/rules/phoneNumberRule'
|
|
import { nationalCodeRule } from '@/constants/rules/nationalCodeRule'
|
|
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)
|