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:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user