feat: add soft delete for classes with cascade to sessions and linked records

This commit is contained in:
2026-08-21 13:19:50 +03:30
parent 5b56171328
commit e34fd25af7
15 changed files with 184 additions and 33 deletions
+3 -3
View File
@@ -24,8 +24,8 @@ const getAdminStats = async () => {
Professor.countDocuments({}),
Professor.countDocuments({ isActive: true }),
Course.countDocuments({}),
Session.countDocuments({}),
Session.find({})
Session.countDocuments({ isDeleted: { $ne: true } }),
Session.find({ isDeleted: { $ne: true } })
.sort({ day: -1 })
.limit(8)
.populate('course', 'title type')
@@ -75,7 +75,7 @@ const getAdminStats = async () => {
// Daily sessions trend (same window)
const dailySessionsRaw = await Session.aggregate([
{ $match: { createdAt: { $gte: rangeStart } } },
{ $match: { isDeleted: { $ne: true }, createdAt: { $gte: rangeStart } } },
{
$group: {
_id: {