feat: add pending student registration flow and pricing APIs.

Support public class lookup, user provisioning, installment pricing, and admin approval before final enrollment.
This commit is contained in:
2026-08-16 08:42:25 +03:30
parent fafc362689
commit cd98adff84
13 changed files with 678 additions and 3 deletions
+16 -1
View File
@@ -202,4 +202,19 @@ const getPublicClasses = async (query = {}) => {
return { data: items.map(enrichClassForDisplay), meta: calculateMeta(total, page, limit) };
};
module.exports = { getAll, getOne, create, update, remove, registerUsers, removeUser, getMyClasses, getPublicClasses };
const getPublicOne = async (id) => {
const cls = await Class.findOne({
_id: id,
isActive: { $ne: false },
showOnFrontend: { $ne: false }
})
.select('name course professor capacity tuitionFee hasDiscount discount freeSpots startDate endDate days startTime endTime isActive')
.populate({ path: 'course', select: 'title type description sectionCount hoursPerSection price' })
.populate({ path: 'professor', select: 'name surname' })
.lean();
if (!cls) throw new AppError('CLASS_NOT_FOUND', null, 'کلاس یافت نشد یا برای ثبت‌نام در دسترس نیست.');
return enrichClassForDisplay(cls);
};
module.exports = { getAll, getOne, create, update, remove, registerUsers, removeUser, getMyClasses, getPublicClasses, getPublicOne };