feat: store payment installments in a transactions collection
Move embedded payment rows into Transaction documents with due dates so remaining tuition can be tracked separately from paid amounts.
This commit is contained in:
@@ -18,8 +18,8 @@ exports.importJson = catchAsync(async (req, res) => {
|
||||
}
|
||||
|
||||
// Allow { data: { courses: [...] } } wrappers
|
||||
if (payload?.data?.courses) payload = payload.data;
|
||||
if (!payload?.courses && payload?.version && payload?.courses == null) {
|
||||
if (payload?.data?.courses || payload?.data?.payments) payload = payload.data;
|
||||
if (!payload?.courses && !payload?.payments) {
|
||||
throw new AppError('VALIDATION_FAILED', null, 'Invalid import payload');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user