feat: add waitlist module, quick payment/transaction edit, and catering fee deduction from professor share

This commit is contained in:
2026-08-23 23:00:02 +03:30
parent e3b51a1629
commit 53fce86ad5
21 changed files with 609 additions and 16 deletions
+66
View File
@@ -0,0 +1,66 @@
// /components/waitlist/waitlistModel.js
'use strict';
const mongoose = require('mongoose');
const uniqueCodePlugin = require('../../utils/mongooseUniqueCodePlugin');
const waitlistSchema = new mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true,
index: true
},
course: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Course',
required: true,
index: true
},
payment: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Payment',
index: true
},
class: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Class',
default: null,
index: true
},
status: {
type: String,
enum: ['waiting', 'enrolled', 'cancelled', 'reverted'],
default: 'waiting',
index: true
},
adminNotes: {
type: [String],
default: []
},
registeredAt: {
type: Date,
default: Date.now
},
assignedAt: {
type: Date,
default: null
},
isDeleted: {
type: Boolean,
default: false,
index: true
},
deletedAt: {
type: Date,
default: null
}
}, {
timestamps: true,
toJSON: { virtuals: true },
toObject: { virtuals: true }
});
waitlistSchema.plugin(uniqueCodePlugin);
module.exports = mongoose.model('Waitlist', waitlistSchema);