@eeplatform/basic-edu 1.3.8 → 1.3.10

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
@@ -4515,7 +4515,6 @@ function useSchoolRepo() {
4515
4515
  { key: { name: 1 } },
4516
4516
  { key: { createdAt: 1 } },
4517
4517
  { key: { name: "text" } },
4518
- { key: { cityMunicipalityPSGC: 1 }, unique: true, name: "unique_psgc" },
4519
4518
  { key: { id: 1, status: 1 }, unique: true, name: "unique_school_id" }
4520
4519
  ]);
4521
4520
  } catch (error) {
@@ -33254,10 +33253,6 @@ function useSchoolService() {
33254
33253
  errors.push(`Row ${rowNum}: name is required`);
33255
33254
  continue;
33256
33255
  }
33257
- if (!province) {
33258
- errors.push(`Row ${rowNum}: province is required`);
33259
- continue;
33260
- }
33261
33256
  if (!cityMunicipality) {
33262
33257
  errors.push(`Row ${rowNum}: city/municipality is required`);
33263
33258
  continue;
@@ -33302,14 +33297,20 @@ ${errors.slice(0, 5).join("\n")}${errors.length > 5 ? `
33302
33297
  session.startTransaction();
33303
33298
  const school = schools[i];
33304
33299
  try {
33305
- const provincePSGC = await getPSGCByName({
33306
- name: school.province ?? "",
33307
- type: "Prov"
33308
- });
33300
+ let provincePSGC = "";
33301
+ if (school.province) {
33302
+ const provinceData = await getPSGCByName({
33303
+ name: school.province,
33304
+ type: "Prov"
33305
+ });
33306
+ if (provinceData) {
33307
+ provincePSGC = provinceData.code ?? "";
33308
+ }
33309
+ }
33309
33310
  const cityMunPSGC = await getPSGCByName({
33310
33311
  name: school.cityMunicipality ?? "",
33311
33312
  type: "City",
33312
- prefix: provincePSGC ? provincePSGC.code.toString().slice(0, 5) : ""
33313
+ prefix: provincePSGC ? provincePSGC.toString().slice(0, 5) : ""
33313
33314
  });
33314
33315
  if (!cityMunPSGC) {
33315
33316
  throw new BadRequestError18(