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
@@ -0,0 +1,35 @@
'use strict';
const { describe, it } = require('node:test');
const assert = require('node:assert/strict');
const waitlistService = require('./waitlistService');
const Waitlist = require('./waitlistModel');
describe('Waitlist Service and Schema', () => {
it('exports all expected service methods', () => {
assert.equal(typeof waitlistService.getAll, 'function');
assert.equal(typeof waitlistService.getOne, 'function');
assert.equal(typeof waitlistService.create, 'function');
assert.equal(typeof waitlistService.update, 'function');
assert.equal(typeof waitlistService.assignToClass, 'function');
assert.equal(typeof waitlistService.revert, 'function');
assert.equal(typeof waitlistService.cancel, 'function');
assert.equal(typeof waitlistService.remove, 'function');
assert.equal(typeof waitlistService.getStats, 'function');
});
it('has valid schema paths in Waitlist model', () => {
assert.ok(Waitlist.schema.path('user'));
assert.ok(Waitlist.schema.path('course'));
assert.ok(Waitlist.schema.path('payment'));
assert.ok(Waitlist.schema.path('class'));
assert.ok(Waitlist.schema.path('status'));
assert.ok(Waitlist.schema.path('isDeleted'));
assert.ok(Waitlist.schema.path('deletedAt'));
const statusPath = Waitlist.schema.path('status');
assert.deepEqual(statusPath.enumValues, ['waiting', 'enrolled', 'cancelled', 'reverted']);
assert.equal(statusPath.defaultValue, 'waiting');
});
});