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
+10 -1
View File
@@ -42,9 +42,15 @@ const paymentSchema = new mongoose.Schema({
},
status: {
type: String,
enum: ['pending', 'partial', 'paid', 'overdue'],
enum: ['pending', 'partial', 'paid', 'overdue', 'cancelled', 'reverted'],
default: 'pending'
},
type: {
type: String,
enum: ['regular', 'waiting_list'],
default: 'regular',
index: true
},
notes: { type: String, trim: true, maxlength: 5000 },
isDeleted: {
type: Boolean,
@@ -72,6 +78,9 @@ paymentSchema.virtual('transactions', {
paymentSchema.pre('save', function (next) {
this.discount = normalizeDiscount(this.discount, this.amount);
const payable = getPayableAmount(this);
if (this.status === 'cancelled' || this.status === 'reverted') {
return next();
}
if (this.paidAmount >= payable) {
this.status = 'paid';
} else if (this.paidAmount > 0) {