@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 +12 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +8 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4402,7 +4402,6 @@ var schemaSchool = Joi10.object({
|
|
|
4402
4402
|
barangay: Joi10.string().max(200).optional().allow(null, ""),
|
|
4403
4403
|
cityMunicipality: Joi10.string().max(100).optional().allow(null, ""),
|
|
4404
4404
|
province: Joi10.string().max(100).optional().allow(null, ""),
|
|
4405
|
-
provincePSGC: Joi10.string().length(10).optional().allow(null, ""),
|
|
4406
4405
|
cityMunicipalityPSGC: Joi10.string().length(10).optional().allow(null, ""),
|
|
4407
4406
|
postalCode: Joi10.string().max(20).optional().allow(null, ""),
|
|
4408
4407
|
contactNumber: Joi10.string().max(20).optional().allow(null, ""),
|
|
@@ -4426,7 +4425,6 @@ var schemaSchoolUpdate = Joi10.object({
|
|
|
4426
4425
|
barangay: Joi10.string().max(200).optional().allow(null, ""),
|
|
4427
4426
|
cityMunicipality: Joi10.string().max(100).optional().allow(null, ""),
|
|
4428
4427
|
province: Joi10.string().max(100).optional().allow(null, ""),
|
|
4429
|
-
provincePSGC: Joi10.string().length(10).optional().allow(null, ""),
|
|
4430
4428
|
cityMunicipalityPSGC: Joi10.string().length(10).optional().allow(null, ""),
|
|
4431
4429
|
postalCode: Joi10.string().max(20).optional().allow(null, ""),
|
|
4432
4430
|
contactNumber: Joi10.string().max(20).optional().allow(null, ""),
|
|
@@ -4483,7 +4481,6 @@ function modelSchool(value) {
|
|
|
4483
4481
|
contactNumber: value.contactNumber ?? "",
|
|
4484
4482
|
email: value.email ?? "",
|
|
4485
4483
|
status: value.status ?? "active",
|
|
4486
|
-
provincePSGC: value.provincePSGC ?? "",
|
|
4487
4484
|
cityMunicipalityPSGC: value.cityMunicipalityPSGC ?? "",
|
|
4488
4485
|
createdBy: value.createdBy ?? "",
|
|
4489
4486
|
createdAt: value.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -4583,7 +4580,7 @@ function useSchoolRepo() {
|
|
|
4583
4580
|
deletedAt: { $in: ["", null] },
|
|
4584
4581
|
status
|
|
4585
4582
|
};
|
|
4586
|
-
sort = Object.keys(sort).length > 0 ? sort : {
|
|
4583
|
+
sort = Object.keys(sort).length > 0 ? sort : {};
|
|
4587
4584
|
const cacheKeyOptions = {
|
|
4588
4585
|
status,
|
|
4589
4586
|
page,
|
|
@@ -4612,12 +4609,12 @@ function useSchoolRepo() {
|
|
|
4612
4609
|
});
|
|
4613
4610
|
return cached;
|
|
4614
4611
|
}
|
|
4615
|
-
const
|
|
4616
|
-
|
|
4617
|
-
{ $sort: sort }
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4612
|
+
const pipeline = [{ $match: query }];
|
|
4613
|
+
if (Object.keys(sort).length > 0) {
|
|
4614
|
+
pipeline.push({ $sort: sort });
|
|
4615
|
+
}
|
|
4616
|
+
pipeline.push({ $skip: page * limit }, { $limit: limit });
|
|
4617
|
+
const items = await collection.aggregate(pipeline).toArray();
|
|
4621
4618
|
const length = await collection.countDocuments(query);
|
|
4622
4619
|
const data = paginate6(items, page, limit, length);
|
|
4623
4620
|
setCache(cacheKey, data, 600).then(() => {
|
|
@@ -33309,22 +33306,16 @@ ${errors.slice(0, 5).join("\n")}${errors.length > 5 ? `
|
|
|
33309
33306
|
name: school.province ?? "",
|
|
33310
33307
|
type: "Prov"
|
|
33311
33308
|
});
|
|
33312
|
-
if (!provincePSGC) {
|
|
33313
|
-
throw new BadRequestError18(
|
|
33314
|
-
`Province '${school.province}' not found in PSGC data.`
|
|
33315
|
-
);
|
|
33316
|
-
}
|
|
33317
33309
|
const cityMunPSGC = await getPSGCByName({
|
|
33318
33310
|
name: school.cityMunicipality ?? "",
|
|
33319
33311
|
type: "City",
|
|
33320
|
-
prefix: provincePSGC.code.toString().slice(0, 5)
|
|
33312
|
+
prefix: provincePSGC ? provincePSGC.code.toString().slice(0, 5) : ""
|
|
33321
33313
|
});
|
|
33322
33314
|
if (!cityMunPSGC) {
|
|
33323
33315
|
throw new BadRequestError18(
|
|
33324
33316
|
`City/Municipality '${school.cityMunicipality}' not found in PSGC data.`
|
|
33325
33317
|
);
|
|
33326
33318
|
}
|
|
33327
|
-
school.provincePSGC = provincePSGC.code ?? "";
|
|
33328
33319
|
school.cityMunicipalityPSGC = cityMunPSGC.code ?? "";
|
|
33329
33320
|
const schoolId = await addSchool(school, session, false);
|
|
33330
33321
|
await addRole(
|