@eeplatform/basic-edu 1.3.6 → 1.3.8

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.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 42a3a20: Update dependencies and addBulk function
8
+
9
+ ## 1.3.7
10
+
11
+ ### Patch Changes
12
+
13
+ - cdddd66: Revise getAll(), remove default sort
14
+
3
15
  ## 1.3.6
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -472,7 +472,6 @@ type TSchool = {
472
472
  barangay?: string;
473
473
  cityMunicipality?: string;
474
474
  province?: string;
475
- provincePSGC?: string;
476
475
  cityMunicipalityPSGC?: string;
477
476
  postalCode?: string;
478
477
  contactNumber?: string;
package/dist/index.js CHANGED
@@ -4401,7 +4401,6 @@ var schemaSchool = import_joi10.default.object({
4401
4401
  barangay: import_joi10.default.string().max(200).optional().allow(null, ""),
4402
4402
  cityMunicipality: import_joi10.default.string().max(100).optional().allow(null, ""),
4403
4403
  province: import_joi10.default.string().max(100).optional().allow(null, ""),
4404
- provincePSGC: import_joi10.default.string().length(10).optional().allow(null, ""),
4405
4404
  cityMunicipalityPSGC: import_joi10.default.string().length(10).optional().allow(null, ""),
4406
4405
  postalCode: import_joi10.default.string().max(20).optional().allow(null, ""),
4407
4406
  contactNumber: import_joi10.default.string().max(20).optional().allow(null, ""),
@@ -4425,7 +4424,6 @@ var schemaSchoolUpdate = import_joi10.default.object({
4425
4424
  barangay: import_joi10.default.string().max(200).optional().allow(null, ""),
4426
4425
  cityMunicipality: import_joi10.default.string().max(100).optional().allow(null, ""),
4427
4426
  province: import_joi10.default.string().max(100).optional().allow(null, ""),
4428
- provincePSGC: import_joi10.default.string().length(10).optional().allow(null, ""),
4429
4427
  cityMunicipalityPSGC: import_joi10.default.string().length(10).optional().allow(null, ""),
4430
4428
  postalCode: import_joi10.default.string().max(20).optional().allow(null, ""),
4431
4429
  contactNumber: import_joi10.default.string().max(20).optional().allow(null, ""),
@@ -4482,7 +4480,6 @@ function modelSchool(value) {
4482
4480
  contactNumber: value.contactNumber ?? "",
4483
4481
  email: value.email ?? "",
4484
4482
  status: value.status ?? "active",
4485
- provincePSGC: value.provincePSGC ?? "",
4486
4483
  cityMunicipalityPSGC: value.cityMunicipalityPSGC ?? "",
4487
4484
  createdBy: value.createdBy ?? "",
4488
4485
  createdAt: value.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -4573,7 +4570,7 @@ function useSchoolRepo() {
4573
4570
  deletedAt: { $in: ["", null] },
4574
4571
  status
4575
4572
  };
4576
- sort = Object.keys(sort).length > 0 ? sort : { _id: 1 };
4573
+ sort = Object.keys(sort).length > 0 ? sort : {};
4577
4574
  const cacheKeyOptions = {
4578
4575
  status,
4579
4576
  page,
@@ -4602,12 +4599,12 @@ function useSchoolRepo() {
4602
4599
  });
4603
4600
  return cached;
4604
4601
  }
4605
- const items = await collection.aggregate([
4606
- { $match: query },
4607
- { $sort: sort },
4608
- { $skip: page * limit },
4609
- { $limit: limit }
4610
- ]).toArray();
4602
+ const pipeline = [{ $match: query }];
4603
+ if (Object.keys(sort).length > 0) {
4604
+ pipeline.push({ $sort: sort });
4605
+ }
4606
+ pipeline.push({ $skip: page * limit }, { $limit: limit });
4607
+ const items = await collection.aggregate(pipeline).toArray();
4611
4608
  const length = await collection.countDocuments(query);
4612
4609
  const data = (0, import_nodejs_utils17.paginate)(items, page, limit, length);
4613
4610
  setCache(cacheKey, data, 600).then(() => {
@@ -33294,22 +33291,16 @@ ${errors.slice(0, 5).join("\n")}${errors.length > 5 ? `
33294
33291
  name: school.province ?? "",
33295
33292
  type: "Prov"
33296
33293
  });
33297
- if (!provincePSGC) {
33298
- throw new import_nodejs_utils18.BadRequestError(
33299
- `Province '${school.province}' not found in PSGC data.`
33300
- );
33301
- }
33302
33294
  const cityMunPSGC = await getPSGCByName({
33303
33295
  name: school.cityMunicipality ?? "",
33304
33296
  type: "City",
33305
- prefix: provincePSGC.code.toString().slice(0, 5)
33297
+ prefix: provincePSGC ? provincePSGC.code.toString().slice(0, 5) : ""
33306
33298
  });
33307
33299
  if (!cityMunPSGC) {
33308
33300
  throw new import_nodejs_utils18.BadRequestError(
33309
33301
  `City/Municipality '${school.cityMunicipality}' not found in PSGC data.`
33310
33302
  );
33311
33303
  }
33312
- school.provincePSGC = provincePSGC.code ?? "";
33313
33304
  school.cityMunicipalityPSGC = cityMunPSGC.code ?? "";
33314
33305
  const schoolId = await addSchool(school, session, false);
33315
33306
  await addRole(