@eeplatform/basic-edu 1.10.15 → 1.10.16
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.d.ts +1 -0
- package/dist/index.js +30 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -383,6 +383,7 @@ declare function useEnrollmentRepo(): {
|
|
|
383
383
|
}>;
|
|
384
384
|
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
385
385
|
getById: (_id: string | ObjectId, status?: string) => Promise<TEnrollment | null>;
|
|
386
|
+
removeProgramById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
386
387
|
};
|
|
387
388
|
|
|
388
389
|
declare function useEnrollmentService(): {
|
package/dist/index.js
CHANGED
|
@@ -3607,13 +3607,38 @@ function useEnrollmentRepo() {
|
|
|
3607
3607
|
throw new Error("Failed to update enrollment status.");
|
|
3608
3608
|
}
|
|
3609
3609
|
}
|
|
3610
|
+
async function removeProgramById(_id, session) {
|
|
3611
|
+
try {
|
|
3612
|
+
_id = new import_mongodb6.ObjectId(_id);
|
|
3613
|
+
} catch (error) {
|
|
3614
|
+
throw new import_nodejs_utils9.BadRequestError(namespace_collection + " Invalid ID.");
|
|
3615
|
+
}
|
|
3616
|
+
try {
|
|
3617
|
+
const result = await collection.updateOne(
|
|
3618
|
+
{ _id },
|
|
3619
|
+
{
|
|
3620
|
+
$set: {
|
|
3621
|
+
specialProgram: "",
|
|
3622
|
+
specialProgramName: "",
|
|
3623
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
3624
|
+
}
|
|
3625
|
+
},
|
|
3626
|
+
{ session }
|
|
3627
|
+
);
|
|
3628
|
+
delCachedData();
|
|
3629
|
+
return result;
|
|
3630
|
+
} catch (error) {
|
|
3631
|
+
throw new Error("Failed to update enrollment program.");
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3610
3634
|
return {
|
|
3611
3635
|
createIndexes,
|
|
3612
3636
|
add,
|
|
3613
3637
|
getAll,
|
|
3614
3638
|
getByApplicantInfo,
|
|
3615
3639
|
updateStatusById,
|
|
3616
|
-
getById
|
|
3640
|
+
getById,
|
|
3641
|
+
removeProgramById
|
|
3617
3642
|
};
|
|
3618
3643
|
}
|
|
3619
3644
|
|
|
@@ -4767,7 +4792,7 @@ var import_joi11 = __toESM(require("joi"));
|
|
|
4767
4792
|
// src/resources/program-screening/program.screening.service.ts
|
|
4768
4793
|
var import_nodejs_utils16 = require("@eeplatform/nodejs-utils");
|
|
4769
4794
|
function useProgramScreeningService() {
|
|
4770
|
-
const { updateStatusById: updateEnrollmentStatusById } = useEnrollmentRepo();
|
|
4795
|
+
const { updateStatusById: updateEnrollmentStatusById, removeProgramById } = useEnrollmentRepo();
|
|
4771
4796
|
const { updateFieldById, getById: getProgramScreeningById } = useProgramScreeningRepo();
|
|
4772
4797
|
async function updateStatusById(id, status) {
|
|
4773
4798
|
const session = import_nodejs_utils16.useAtlas.getClient()?.startSession();
|
|
@@ -4783,6 +4808,9 @@ function useProgramScreeningService() {
|
|
|
4783
4808
|
);
|
|
4784
4809
|
let enrollmentStatus = "pending";
|
|
4785
4810
|
const ReclassifyCond = status === "reclassified" && application.status && ["failed", "withdrawn"].includes(application.status);
|
|
4811
|
+
if (ReclassifyCond) {
|
|
4812
|
+
await removeProgramById(String(application.applicant), session);
|
|
4813
|
+
}
|
|
4786
4814
|
if (status === "passed" && application.status === "pending" || ReclassifyCond) {
|
|
4787
4815
|
enrollmentStatus = "pending";
|
|
4788
4816
|
}
|