This commit is contained in:
@@ -3,9 +3,16 @@ import { array, boolean, mixed, number, object, string } from 'yup'
|
||||
export const courseSchema = object().shape({
|
||||
title: string().required().min(3).max(255),
|
||||
teacherId: mixed().required(),
|
||||
capacity: number().typeError('ظرفیت باید عدد باشد').required().min(1),
|
||||
capacity: number()
|
||||
.typeError('ظرفیت باید بهصورت عدد وارد شود')
|
||||
.required()
|
||||
.integer('ظرفیت باید عدد صحیح باشد')
|
||||
.min(1, 'ظرفیت باید حداقل ۱ نفر باشد'),
|
||||
prerequisiteCourseIds: array().nullable().default([]),
|
||||
contentMediaId: number().nullable().notRequired(),
|
||||
contentMediaId: number()
|
||||
.typeError('شناسه فایل محتوای دوره باید عدد باشد')
|
||||
.nullable()
|
||||
.notRequired(),
|
||||
description: string().nullable().notRequired(),
|
||||
termId: mixed().required(),
|
||||
isActive: boolean().nullable().notRequired(),
|
||||
@@ -14,7 +21,11 @@ export const courseSchema = object().shape({
|
||||
export const offeredCourseSchema = object().shape({
|
||||
termId: string().required(),
|
||||
title: string().required(),
|
||||
capacity: string().required(),
|
||||
capacity: number()
|
||||
.typeError('ظرفیت باید بهصورت عدد وارد شود')
|
||||
.required()
|
||||
.integer('ظرفیت باید عدد صحیح باشد')
|
||||
.min(1, 'ظرفیت باید حداقل ۱ نفر باشد'),
|
||||
imageId: string().nullable().notRequired(),
|
||||
isActive: boolean().nullable().notRequired(),
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ export const termSchema = object().shape({
|
||||
isActive: boolean().default(true),
|
||||
minimumScore: number().typeError('حد نصاب قبولی باید عدد باشد').required(),
|
||||
score: number().typeError('کل نمره آزمون باید عدد باشد').required(),
|
||||
coverMediaId: number().nullable().notRequired(),
|
||||
coverMediaId: number().typeError('شناسه تصویر جلد باید عدد باشد').nullable().notRequired(),
|
||||
})
|
||||
|
||||
export const addTermStudentSchema = object().shape({
|
||||
|
||||
@@ -20,7 +20,7 @@ const baseUserShape = {
|
||||
provinceId: string().nullable().notRequired(),
|
||||
cityId: string().nullable().notRequired(),
|
||||
address: string().nullable().notRequired(),
|
||||
avatarMediaId: number().nullable().notRequired(),
|
||||
avatarMediaId: number().typeError('شناسه تصویر پروفایل باید عدد باشد').nullable().notRequired(),
|
||||
}
|
||||
|
||||
export const userAddSchema = object().shape({
|
||||
|
||||
@@ -25,10 +25,15 @@ export const personalInformationSchema = object().shape({
|
||||
.matches(/^\d{10}$/, 'کد پستی باید ۱۰ رقم باشد'),
|
||||
virtualPhoneNumber: string()
|
||||
.required()
|
||||
.matches(/^\d{10,15}$/, 'شماره تلفن مجازی نامعتبر است'),
|
||||
.matches(/^\d{10,15}$/, 'شماره تلفن مجازی باید فقط شامل ۱۰ تا ۱۵ رقم باشد'),
|
||||
seminaryCode: requiredString(),
|
||||
seminaryServiceCenterCode: requiredString(),
|
||||
childrenCount: number().typeError('تعداد فرزند باید عدد باشد').required().min(0).max(20),
|
||||
childrenCount: number()
|
||||
.typeError('تعداد فرزند باید بهصورت عدد وارد شود')
|
||||
.required()
|
||||
.integer('تعداد فرزند باید عدد صحیح باشد')
|
||||
.min(0, 'تعداد فرزند نمیتواند کمتر از صفر باشد')
|
||||
.max(20, 'تعداد فرزند نمیتواند بیشتر از ۲۰ باشد'),
|
||||
})
|
||||
|
||||
export const educationalInformationSchema = object().shape({
|
||||
@@ -42,10 +47,11 @@ export const educationalInformationSchema = object().shape({
|
||||
|
||||
export const professionalInformationSchema = object().shape({
|
||||
propagationExperienceYears: number()
|
||||
.typeError('سنوات تجربه تبلیغ باید عدد باشد')
|
||||
.typeError('سابقه فعالیت تبلیغی باید بهصورت عدد وارد شود')
|
||||
.required()
|
||||
.min(0)
|
||||
.max(70),
|
||||
.integer('سابقه فعالیت تبلیغی باید عدد صحیح باشد')
|
||||
.min(0, 'سابقه فعالیت تبلیغی نمیتواند کمتر از صفر باشد')
|
||||
.max(70, 'سابقه فعالیت تبلیغی نمیتواند بیشتر از ۷۰ سال باشد'),
|
||||
propagationMethodDescription: requiredString(10),
|
||||
specializedTopics: requiredString(10),
|
||||
propagationPlatforms: array()
|
||||
|
||||
@@ -22,7 +22,10 @@ export const studentProfileSchema = object().shape({
|
||||
virtualPhoneNumber: string()
|
||||
.nullable()
|
||||
.notRequired()
|
||||
.matches(/^\d{10,15}$/, { message: 'شماره تلفن مجازی نامعتبر است', excludeEmptyString: true }),
|
||||
.matches(/^\d{10,15}$/, {
|
||||
message: 'شماره تلفن مجازی باید فقط شامل ۱۰ تا ۱۵ رقم باشد',
|
||||
excludeEmptyString: true,
|
||||
}),
|
||||
seminaryCode: string().nullable().notRequired(),
|
||||
seminaryServiceCenterCode: string().nullable().notRequired(),
|
||||
childrenCount: string()
|
||||
|
||||
Reference in New Issue
Block a user