@eeplatform/basic-edu 1.10.14 → 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/dist/index.mjs CHANGED
@@ -3505,13 +3505,38 @@ function useEnrollmentRepo() {
3505
3505
  throw new Error("Failed to update enrollment status.");
3506
3506
  }
3507
3507
  }
3508
+ async function removeProgramById(_id, session) {
3509
+ try {
3510
+ _id = new ObjectId6(_id);
3511
+ } catch (error) {
3512
+ throw new BadRequestError9(namespace_collection + " Invalid ID.");
3513
+ }
3514
+ try {
3515
+ const result = await collection.updateOne(
3516
+ { _id },
3517
+ {
3518
+ $set: {
3519
+ specialProgram: "",
3520
+ specialProgramName: "",
3521
+ updatedAt: /* @__PURE__ */ new Date()
3522
+ }
3523
+ },
3524
+ { session }
3525
+ );
3526
+ delCachedData();
3527
+ return result;
3528
+ } catch (error) {
3529
+ throw new Error("Failed to update enrollment program.");
3530
+ }
3531
+ }
3508
3532
  return {
3509
3533
  createIndexes,
3510
3534
  add,
3511
3535
  getAll,
3512
3536
  getByApplicantInfo,
3513
3537
  updateStatusById,
3514
- getById
3538
+ getById,
3539
+ removeProgramById
3515
3540
  };
3516
3541
  }
3517
3542
 
@@ -4696,7 +4721,7 @@ import Joi11 from "joi";
4696
4721
  // src/resources/program-screening/program.screening.service.ts
4697
4722
  import { AppError as AppError8, useAtlas as useAtlas8 } from "@eeplatform/nodejs-utils";
4698
4723
  function useProgramScreeningService() {
4699
- const { updateStatusById: updateEnrollmentStatusById } = useEnrollmentRepo();
4724
+ const { updateStatusById: updateEnrollmentStatusById, removeProgramById } = useEnrollmentRepo();
4700
4725
  const { updateFieldById, getById: getProgramScreeningById } = useProgramScreeningRepo();
4701
4726
  async function updateStatusById(id, status) {
4702
4727
  const session = useAtlas8.getClient()?.startSession();
@@ -4712,6 +4737,9 @@ function useProgramScreeningService() {
4712
4737
  );
4713
4738
  let enrollmentStatus = "pending";
4714
4739
  const ReclassifyCond = status === "reclassified" && application.status && ["failed", "withdrawn"].includes(application.status);
4740
+ if (ReclassifyCond) {
4741
+ await removeProgramById(String(application.applicant), session);
4742
+ }
4715
4743
  if (status === "passed" && application.status === "pending" || ReclassifyCond) {
4716
4744
  enrollmentStatus = "pending";
4717
4745
  }
@@ -46616,7 +46644,6 @@ function useKindergartenRoutineRepo() {
46616
46644
  } = {}) {
46617
46645
  page = page > 0 ? page - 1 : 0;
46618
46646
  const query = {
46619
- deletedAt: { $in: ["", null] },
46620
46647
  status
46621
46648
  };
46622
46649
  sort = Object.keys(sort).length > 0 ? sort : { _id: 1 };
@@ -46965,7 +46992,7 @@ function useKindergartenRoutineController() {
46965
46992
  const limit = typeof req.query.limit === "string" ? Number(req.query.limit) : 10;
46966
46993
  const search = req.query.search ?? "";
46967
46994
  const status = req.query.status ?? "active";
46968
- const school = req.query.school ?? "";
46995
+ const school = req.params.school ?? "";
46969
46996
  const section = req.query.section ?? "";
46970
46997
  const classroom = req.query.classroom ?? "";
46971
46998
  const type = req.query.type ?? "";
@@ -47191,9 +47218,10 @@ function useKindergartenDomainRepo() {
47191
47218
  { key: { createdBy: 1 } },
47192
47219
  { key: { title: "text" } },
47193
47220
  {
47194
- key: { title: 1, school: 1, status: 1 },
47221
+ key: { title: 1, school: 1 },
47195
47222
  unique: true,
47196
- name: "unique_kindergarten_domain"
47223
+ name: "unique_kindergarten_domain",
47224
+ partialFilterExpression: { status: "active" }
47197
47225
  }
47198
47226
  ]);
47199
47227
  } catch (error) {
@@ -47516,6 +47544,8 @@ function useKindergartenDomainService() {
47516
47544
  );
47517
47545
  }
47518
47546
  await _deleteById(id, session);
47547
+ await session.commitTransaction();
47548
+ return "Successfully deleted kindergarten domain.";
47519
47549
  } catch (error) {
47520
47550
  await session.abortTransaction();
47521
47551
  if (error instanceof AppError33) {
@@ -47576,7 +47606,7 @@ function useKindergartenDomainController() {
47576
47606
  const limit = typeof req.query.limit === "string" ? Number(req.query.limit) : 10;
47577
47607
  const search = req.query.search ?? "";
47578
47608
  const status = req.query.status ?? "active";
47579
- const school = req.query.school ?? "";
47609
+ const school = req.params.school ?? "";
47580
47610
  const createdBy = req.query.createdBy ?? "";
47581
47611
  const isPageNumber = isFinite(page);
47582
47612
  if (!isPageNumber) {