strapi-plugin-navigation 1.1.2 → 1.1.3
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/README.md +5 -0
- package/config/schema.graphql.js +6 -1
- package/package.json +1 -1
- package/services/navigation.js +4 -2
package/README.md
CHANGED
|
@@ -23,6 +23,11 @@ A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provid
|
|
|
23
23
|
|
|
24
24
|
<img src="public/assets/preview.png" alt="UI preview" />
|
|
25
25
|
|
|
26
|
+
### Versions
|
|
27
|
+
|
|
28
|
+
- **Stable** - [v1.1.2](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation)
|
|
29
|
+
- **Beta** - v4 support - [v2.0.0-beta.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/feat/strapi-v4-support)
|
|
30
|
+
|
|
26
31
|
### ⏳ Installation
|
|
27
32
|
|
|
28
33
|
(Use **yarn** to install this plugin within your Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
|
package/config/schema.graphql.js
CHANGED
|
@@ -66,7 +66,7 @@ module.exports = {
|
|
|
66
66
|
parent: Int
|
|
67
67
|
master: Int
|
|
68
68
|
items: [NavigationItem]
|
|
69
|
-
related: NavigationRelated
|
|
69
|
+
related: [NavigationRelated]
|
|
70
70
|
audience: [String]
|
|
71
71
|
${NAVIGATION_DATE}
|
|
72
72
|
${NAVIGATION_USER}
|
|
@@ -148,6 +148,11 @@ module.exports = {
|
|
|
148
148
|
navigationUpdate(id: String!, navigation: CreateNavigation!): Navigation!
|
|
149
149
|
`,
|
|
150
150
|
resolver: {
|
|
151
|
+
NavigationRelated: {
|
|
152
|
+
__resolveType: (data) => {
|
|
153
|
+
return strapi.contentTypes[data.__contentType]?.globalId
|
|
154
|
+
}
|
|
155
|
+
},
|
|
151
156
|
Query: {
|
|
152
157
|
renderNavigation: {
|
|
153
158
|
resolverOf: 'plugins::navigation.navigation.render',
|
package/package.json
CHANGED
package/services/navigation.js
CHANGED
|
@@ -185,7 +185,8 @@ module.exports = {
|
|
|
185
185
|
_limit: -1,
|
|
186
186
|
_sort: 'order:asc',
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
let entities = await this.getRelatedItems(entityItems);
|
|
189
|
+
entities = entities.map((_) => sanitizeEntity(_, { model: itemModel }));
|
|
189
190
|
return {
|
|
190
191
|
...sanitizeEntity(entity,
|
|
191
192
|
{ model: masterModel },
|
|
@@ -301,7 +302,8 @@ module.exports = {
|
|
|
301
302
|
if (!entities) {
|
|
302
303
|
return [];
|
|
303
304
|
}
|
|
304
|
-
|
|
305
|
+
let items = await this.getRelatedItems(entities);
|
|
306
|
+
items = items.map((_) => sanitizeEntity(_, { model: itemModel }));
|
|
305
307
|
const { contentTypes, contentTypesNameFields } = await service.config();
|
|
306
308
|
|
|
307
309
|
switch (type?.toLowerCase()) {
|