@eeplatform/basic-edu 1.8.5 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5479,9 +5479,21 @@ function useEnrollmentService() {
|
|
|
5479
5479
|
const session = client.startSession();
|
|
5480
5480
|
try {
|
|
5481
5481
|
session.startTransaction();
|
|
5482
|
-
const enrollment = await _getById(_id
|
|
5482
|
+
const enrollment = await _getById(_id);
|
|
5483
5483
|
if (!enrollment) {
|
|
5484
|
-
throw new NotFoundError("Enrollment not found
|
|
5484
|
+
throw new NotFoundError("Enrollment not found.");
|
|
5485
|
+
}
|
|
5486
|
+
if (status === "accepted" && enrollment.status == "rejected") {
|
|
5487
|
+
throw new BadRequestError19("Rejected enrollments cannot be accepted.");
|
|
5488
|
+
}
|
|
5489
|
+
if (status === "accepted" && enrollment.status == "accepted") {
|
|
5490
|
+
throw new BadRequestError19("Enrollment is already accepted.");
|
|
5491
|
+
}
|
|
5492
|
+
if (status === "rejected" && enrollment.status == "rejected") {
|
|
5493
|
+
throw new BadRequestError19("Enrollment is already rejected.");
|
|
5494
|
+
}
|
|
5495
|
+
if (status === "rejected" && enrollment.status == "accepted") {
|
|
5496
|
+
throw new BadRequestError19("Accepted enrollments cannot be rejected.");
|
|
5485
5497
|
}
|
|
5486
5498
|
const result = await _updateStatusById(_id, status, session);
|
|
5487
5499
|
if (result.modifiedCount === 0) {
|
|
@@ -5519,6 +5531,7 @@ function useEnrollmentService() {
|
|
|
5519
5531
|
await incrementById(counterId, session);
|
|
5520
5532
|
}
|
|
5521
5533
|
enrollment.specialProgram = enrollment.specialProgram?.toString();
|
|
5534
|
+
enrollment.createdBy = enrollment.createdBy?.toString();
|
|
5522
5535
|
await addLearner(enrollment, session);
|
|
5523
5536
|
}
|
|
5524
5537
|
await session.commitTransaction();
|