feat: add soft delete for classes with cascade to sessions and linked records
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user