@eeplatform/basic-edu 1.10.19 → 1.10.21

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,17 @@
1
1
  # @eeplatform/basic-edu
2
2
 
3
+ ## 1.10.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 82c1c45: Adjust enrollment status handling and minor fixes
8
+
9
+ ## 1.10.20
10
+
11
+ ### Patch Changes
12
+
13
+ - 149fe29: Add getById handler to school controller
14
+
3
15
  ## 1.10.19
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -698,6 +698,7 @@ declare function useSchoolController(): {
698
698
  updateFieldById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
699
699
  updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
700
700
  deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
701
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
701
702
  };
702
703
 
703
704
  type TAsset = {
package/dist/index.js CHANGED
@@ -3232,7 +3232,6 @@ function MLearner(value) {
3232
3232
  if (value.specialProgram && typeof value.specialProgram === "string") {
3233
3233
  try {
3234
3234
  value.specialProgram = new import_mongodb5.ObjectId(value.specialProgram);
3235
- value.status = "screening";
3236
3235
  } catch (error2) {
3237
3236
  throw new import_nodejs_utils8.BadRequestError("Invalid specialProgram format");
3238
3237
  }
@@ -34650,7 +34649,8 @@ function useSchoolController() {
34650
34649
  updateStatusById: _updateStatusById,
34651
34650
  updateFieldById: _updateFieldById,
34652
34651
  updateById: _updateById,
34653
- deleteById: _deleteById
34652
+ deleteById: _deleteById,
34653
+ getById: _getById
34654
34654
  } = useSchoolRepo();
34655
34655
  const {
34656
34656
  add: _addSchool,
@@ -34891,6 +34891,22 @@ function useSchoolController() {
34891
34891
  next(error2);
34892
34892
  }
34893
34893
  }
34894
+ async function getById(req, res, next) {
34895
+ const schoolId = req.params.id;
34896
+ const validation = import_joi15.default.string().hex().required();
34897
+ const { error } = validation.validate(schoolId);
34898
+ if (error) {
34899
+ next(new import_nodejs_utils24.BadRequestError(`Validation error: ${error.message}`));
34900
+ return;
34901
+ }
34902
+ try {
34903
+ const school = await _getById(schoolId);
34904
+ res.status(200).json(school);
34905
+ return;
34906
+ } catch (error2) {
34907
+ next(error2);
34908
+ }
34909
+ }
34894
34910
  return {
34895
34911
  add,
34896
34912
  getAll,
@@ -34901,7 +34917,8 @@ function useSchoolController() {
34901
34917
  addBulk,
34902
34918
  updateFieldById,
34903
34919
  updateById,
34904
- deleteById
34920
+ deleteById,
34921
+ getById
34905
34922
  };
34906
34923
  }
34907
34924
 
@@ -36188,7 +36205,6 @@ function useEnrollmentService() {
36188
36205
  if (status === "accepted") {
36189
36206
  delete enrollment._id;
36190
36207
  enrollment.school = enrollment.school.toString();
36191
- enrollment.status = "active";
36192
36208
  enrollment.updatedAt = "";
36193
36209
  enrollment.createdAt = /* @__PURE__ */ new Date();
36194
36210
  enrollment.deletedAt = "";
@@ -36224,14 +36240,13 @@ function useEnrollmentService() {
36224
36240
  if (enrollment.seniorHighInfo?.strand) {
36225
36241
  enrollment.seniorHighInfo.strand = enrollment.seniorHighInfo?.strand?.toString();
36226
36242
  }
36243
+ enrollment.status = "active";
36227
36244
  await addLearner(enrollment, session);
36228
36245
  }
36229
36246
  const programScreening = await getByApplicantId(_id);
36230
36247
  if (programScreening) {
36231
36248
  if (["cancelled", "withdrawn"].includes(status)) {
36232
36249
  await updateStatusByApplicantId(_id, "cancelled", session);
36233
- } else {
36234
- await updateStatusByApplicantId(_id, status, session);
36235
36250
  }
36236
36251
  }
36237
36252
  await session.commitTransaction();