@mattisvensson/strapi-plugin-webatlas 0.2.3 → 0.2.4
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/server/index.js +10 -3
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +10 -3
- package/dist/server/index.mjs.map +1 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function transformToUrl(input) {
|
|
|
20
20
|
input = input.replace(/-+/g, "-");
|
|
21
21
|
return input;
|
|
22
22
|
}
|
|
23
|
-
const version = "0.2.
|
|
23
|
+
const version = "0.2.4";
|
|
24
24
|
const keywords = [];
|
|
25
25
|
const type = "commonjs";
|
|
26
26
|
const exports$1 = {
|
|
@@ -206,6 +206,7 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
206
206
|
if (!config2?.selectedContentTypes) return;
|
|
207
207
|
strapi2.db?.lifecycles.subscribe({
|
|
208
208
|
models: [waNavItem],
|
|
209
|
+
// TODO: is beforeDelete needed?
|
|
209
210
|
async beforeDelete(event) {
|
|
210
211
|
const id = event.params.where["id"];
|
|
211
212
|
if (!id) return;
|
|
@@ -216,6 +217,7 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
216
217
|
},
|
|
217
218
|
populate: ["route"]
|
|
218
219
|
});
|
|
220
|
+
if (!navItem || !navItem.route) return;
|
|
219
221
|
event.state = navItem.route.id && !navItem.route.internal ? { id: navItem.route.id } : null;
|
|
220
222
|
} catch (err) {
|
|
221
223
|
console.log(err);
|
|
@@ -248,6 +250,12 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
248
250
|
webatlas_override
|
|
249
251
|
} = event.params.data;
|
|
250
252
|
if (!webatlas_path) return;
|
|
253
|
+
const relatedRoute = await strapi2.db?.query(waRoute).findOne({
|
|
254
|
+
where: {
|
|
255
|
+
relatedDocumentId: event.result.documentId
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
if (relatedRoute) return;
|
|
251
259
|
const title = ctSettings?.default ? event.params.data[ctSettings.default] : "";
|
|
252
260
|
const path = await duplicateCheck(transformToUrl(webatlas_path));
|
|
253
261
|
await strapi2.documents(waRoute).create({
|
|
@@ -297,8 +305,6 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
297
305
|
}
|
|
298
306
|
});
|
|
299
307
|
} else {
|
|
300
|
-
console.log("updating route", relatedRoute.documentId);
|
|
301
|
-
console.log("with data", routeData);
|
|
302
308
|
await strapi2.documents(waRoute).update({
|
|
303
309
|
documentId: relatedRoute.documentId,
|
|
304
310
|
data: {
|
|
@@ -5835,3 +5841,4 @@ const index = {
|
|
|
5835
5841
|
middlewares
|
|
5836
5842
|
};
|
|
5837
5843
|
module.exports = index;
|
|
5844
|
+
//# sourceMappingURL=index.js.map
|