import { array, boolean, mixed, number, object, string } from 'yup' export const courseSchema = object().shape({ title: string().required().min(3).max(255), // The backend intentionally allows courses without an assigned teacher. teacherId: mixed().nullable().notRequired(), capacity: number() .typeError('ظرفیت باید به‌صورت عدد وارد شود') .required() .integer('ظرفیت باید عدد صحیح باشد') .min(1, 'ظرفیت باید حداقل ۱ نفر باشد'), prerequisiteCourseIds: array().nullable().default([]), coverMediaId: number().typeError('شناسه تصویر دوره باید عدد باشد').nullable().notRequired(), description: string().nullable().notRequired(), termId: mixed().required(), isActive: boolean().nullable().notRequired(), }) export const offeredCourseSchema = object().shape({ termId: string().required(), title: string().required(), capacity: number() .typeError('ظرفیت باید به‌صورت عدد وارد شود') .required() .integer('ظرفیت باید عدد صحیح باشد') .min(1, 'ظرفیت باید حداقل ۱ نفر باشد'), imageId: string().nullable().notRequired(), isActive: boolean().nullable().notRequired(), })