@eeplatform/basic-edu 1.8.2 → 1.8.3

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/basic-edu
2
2
 
3
+ ## 1.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 20e4896: Program Screening - add two more status and action
8
+
3
9
  ## 1.8.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -4524,10 +4524,7 @@ var import_joi11 = __toESM(require("joi"));
4524
4524
  // src/resources/program-screening/program.screening.service.ts
4525
4525
  var import_nodejs_utils16 = require("@eeplatform/nodejs-utils");
4526
4526
  function useProgramScreeningService() {
4527
- const {
4528
- updateStatusById: updateEnrollmentStatusById,
4529
- getById: getEnrollmentById
4530
- } = useEnrollmentRepo();
4527
+ const { updateStatusById: updateEnrollmentStatusById } = useEnrollmentRepo();
4531
4528
  const { updateFieldById, getById: getProgramScreeningById } = useProgramScreeningRepo();
4532
4529
  async function updateStatusById(id, status) {
4533
4530
  const session = import_nodejs_utils16.useAtlas.getClient()?.startSession();
@@ -4537,20 +4534,21 @@ function useProgramScreeningService() {
4537
4534
  if (!application) {
4538
4535
  throw new import_nodejs_utils16.AppError("Application not found", 404);
4539
4536
  }
4540
- if (application.status !== "pending") {
4541
- throw new import_nodejs_utils16.AppError("Only pending applications can be updated", 400);
4542
- }
4543
4537
  await updateFieldById(
4544
4538
  { _id: id, field: "status", value: status },
4545
4539
  session
4546
4540
  );
4547
4541
  let enrollmentStatus = "pending";
4548
- if (status === "passed") {
4542
+ const ReclassifyCond = status === "reclassified" && application.status && ["failed", "withdrawn"].includes(application.status);
4543
+ if (status === "passed" && application.status === "pending" || ReclassifyCond) {
4549
4544
  enrollmentStatus = "pending";
4550
4545
  }
4551
- if (status === "failed") {
4546
+ if (status === "failed" && application.status === "pending") {
4552
4547
  enrollmentStatus = "failed-screening";
4553
4548
  }
4549
+ if (status === "withdrawn" && application.status === "pending") {
4550
+ enrollmentStatus = "withdrawn-screening";
4551
+ }
4554
4552
  await updateEnrollmentStatusById(
4555
4553
  application.applicant,
4556
4554
  enrollmentStatus,