33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import { number, 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({
|
|
reason: string().required(),
|
|
})
|
|
|
|
const baseUserShape = {
|
|
role: string().required(),
|
|
name: string().required().min(3),
|
|
phone: phoneNumberRule,
|
|
nationalCode: nationalCodeRule,
|
|
birthday: 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(),
|
|
avatarMediaId: number().typeError('شناسه تصویر پروفایل باید عدد باشد').nullable().notRequired(),
|
|
}
|
|
|
|
export const userAddSchema = object().shape({
|
|
...baseUserShape,
|
|
password: passwordRule,
|
|
passwordConfirmation: passwordConfirmationRule,
|
|
})
|
|
|
|
export const userEditSchema = object().shape(baseUserShape)
|