@eeplatform/core 1.8.6 → 1.8.7
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 +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6265,6 +6265,40 @@ function usePSGCRepo() {
|
|
|
6265
6265
|
throw new InternalServerError19("Failed to delete PSGC.");
|
|
6266
6266
|
}
|
|
6267
6267
|
}
|
|
6268
|
+
async function setRegionProvinceName() {
|
|
6269
|
+
try {
|
|
6270
|
+
const cities = await collection.find({ type: { $in: ["City", "Mun"] } }).toArray();
|
|
6271
|
+
for (let index = 0; index < cities.length; index++) {
|
|
6272
|
+
const city = cities[index];
|
|
6273
|
+
if (city.region) {
|
|
6274
|
+
continue;
|
|
6275
|
+
}
|
|
6276
|
+
const province = await collection.findOne({
|
|
6277
|
+
type: "Prov",
|
|
6278
|
+
code: { $regex: `^${city.code.substring(0, 5)}` }
|
|
6279
|
+
});
|
|
6280
|
+
if (province) {
|
|
6281
|
+
await collection.updateOne(
|
|
6282
|
+
{ _id: city._id },
|
|
6283
|
+
{ $set: { province: province.name } }
|
|
6284
|
+
);
|
|
6285
|
+
}
|
|
6286
|
+
const region = await collection.findOne({
|
|
6287
|
+
type: "Reg",
|
|
6288
|
+
code: { $regex: `^${city.code.substring(0, 2)}` }
|
|
6289
|
+
});
|
|
6290
|
+
if (region) {
|
|
6291
|
+
await collection.updateOne(
|
|
6292
|
+
{ _id: city._id },
|
|
6293
|
+
{ $set: { region: region.name } }
|
|
6294
|
+
);
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
return "Successfully set region name as province name for cities.";
|
|
6298
|
+
} catch (error) {
|
|
6299
|
+
console.log(error);
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6268
6302
|
return {
|
|
6269
6303
|
createIndexes,
|
|
6270
6304
|
add,
|
|
@@ -6272,7 +6306,8 @@ function usePSGCRepo() {
|
|
|
6272
6306
|
getById,
|
|
6273
6307
|
updateFieldById,
|
|
6274
6308
|
deleteById,
|
|
6275
|
-
getByName
|
|
6309
|
+
getByName,
|
|
6310
|
+
setRegionProvinceName
|
|
6276
6311
|
};
|
|
6277
6312
|
}
|
|
6278
6313
|
|