@eeplatform/basic-edu 1.8.4 → 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 +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eeplatform/basic-edu
|
|
2
2
|
|
|
3
|
+
## 1.8.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 41403d6: Enrollment management - fix enrollment status update
|
|
8
|
+
|
|
9
|
+
## 1.8.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b6607f7: Enrollment management - updated getById return type
|
|
14
|
+
|
|
3
15
|
## 1.8.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -367,7 +367,7 @@ declare function useEnrollmentRepo(): {
|
|
|
367
367
|
length: number;
|
|
368
368
|
}>;
|
|
369
369
|
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
370
|
-
getById: (_id: string | ObjectId, status?: string) => Promise<
|
|
370
|
+
getById: (_id: string | ObjectId, status?: string) => Promise<TEnrollment | null>;
|
|
371
371
|
};
|
|
372
372
|
|
|
373
373
|
declare function useEnrollmentService(): {
|
package/dist/index.js
CHANGED
|
@@ -5523,9 +5523,21 @@ function useEnrollmentService() {
|
|
|
5523
5523
|
const session = client.startSession();
|
|
5524
5524
|
try {
|
|
5525
5525
|
session.startTransaction();
|
|
5526
|
-
const enrollment = await _getById(_id
|
|
5526
|
+
const enrollment = await _getById(_id);
|
|
5527
5527
|
if (!enrollment) {
|
|
5528
|
-
throw new import_nodejs_utils21.NotFoundError("Enrollment not found
|
|
5528
|
+
throw new import_nodejs_utils21.NotFoundError("Enrollment not found.");
|
|
5529
|
+
}
|
|
5530
|
+
if (status === "accepted" && enrollment.status == "rejected") {
|
|
5531
|
+
throw new import_nodejs_utils21.BadRequestError("Rejected enrollments cannot be accepted.");
|
|
5532
|
+
}
|
|
5533
|
+
if (status === "accepted" && enrollment.status == "accepted") {
|
|
5534
|
+
throw new import_nodejs_utils21.BadRequestError("Enrollment is already accepted.");
|
|
5535
|
+
}
|
|
5536
|
+
if (status === "rejected" && enrollment.status == "rejected") {
|
|
5537
|
+
throw new import_nodejs_utils21.BadRequestError("Enrollment is already rejected.");
|
|
5538
|
+
}
|
|
5539
|
+
if (status === "rejected" && enrollment.status == "accepted") {
|
|
5540
|
+
throw new import_nodejs_utils21.BadRequestError("Accepted enrollments cannot be rejected.");
|
|
5529
5541
|
}
|
|
5530
5542
|
const result = await _updateStatusById(_id, status, session);
|
|
5531
5543
|
if (result.modifiedCount === 0) {
|
|
@@ -5562,6 +5574,8 @@ function useEnrollmentService() {
|
|
|
5562
5574
|
enrollment.learnerInfo.lrn = lrn;
|
|
5563
5575
|
await incrementById(counterId, session);
|
|
5564
5576
|
}
|
|
5577
|
+
enrollment.specialProgram = enrollment.specialProgram?.toString();
|
|
5578
|
+
enrollment.createdBy = enrollment.createdBy?.toString();
|
|
5565
5579
|
await addLearner(enrollment, session);
|
|
5566
5580
|
}
|
|
5567
5581
|
await session.commitTransaction();
|