@strapi/plugin-documentation 4.10.0-beta.1 → 4.10.1-experimental.0
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/admin/src/pages/PluginPage/index.js +3 -3
- package/admin/src/pages/utils/useReactQuery.js +34 -14
- package/jest.config.front.js +5 -0
- package/jest.config.js +5 -0
- package/package.json +8 -5
- package/server/config/default-plugin-config.js +2 -41
- package/server/services/__mocks__/mock-content-types.js +269 -0
- package/server/services/__mocks__/mock-strapi-data.js +183 -0
- package/server/services/__tests__/build-component-schema.test.js +761 -0
- package/server/services/__tests__/documentation.test.js +481 -0
- package/server/services/__tests__/override.test.js +85 -0
- package/server/services/documentation.js +123 -84
- package/server/services/helpers/build-api-endpoint-path.js +3 -2
- package/server/services/helpers/build-component-schema.js +108 -70
- package/server/services/helpers/utils/clean-schema-attributes.js +15 -7
- package/server/services/helpers/utils/loop-content-type-names.js +3 -1
- package/server/services/index.js +2 -0
- package/server/services/override.js +52 -0
- package/server/services/utils/default-openapi-components.js +40 -0
- package/server/services/utils/get-plugins-that-need-documentation.js +24 -0
- package/__mocks__/strapi.js +0 -41
- package/__tests__/build-component-schema.test.js +0 -271
- package/admin/src/pages/utils/api.js +0 -31
|
@@ -51,9 +51,9 @@ const PluginPage = () => {
|
|
|
51
51
|
const colCount = 4;
|
|
52
52
|
const rowCount = (data?.docVersions?.length || 0) + 1;
|
|
53
53
|
|
|
54
|
-
const openDocVersion = () => {
|
|
54
|
+
const openDocVersion = (version) => {
|
|
55
55
|
const slash = data?.prefix.startsWith('/') ? '' : '/';
|
|
56
|
-
openWithNewTab(`${slash}${data?.prefix}/v${
|
|
56
|
+
openWithNewTab(`${slash}${data?.prefix}/v${version}`);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const handleRegenerateDoc = (version) => {
|
|
@@ -141,7 +141,7 @@ const PluginPage = () => {
|
|
|
141
141
|
<Td>
|
|
142
142
|
<Flex justifyContent="end" {...stopPropagation}>
|
|
143
143
|
<IconButton
|
|
144
|
-
onClick={openDocVersion}
|
|
144
|
+
onClick={() => openDocVersion(doc.version)}
|
|
145
145
|
noBorder
|
|
146
146
|
icon={<Show />}
|
|
147
147
|
label={formatMessage(
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
|
2
|
-
import { useNotification } from '@strapi/helper-plugin';
|
|
3
|
-
import
|
|
2
|
+
import { useNotification, useFetchClient } from '@strapi/helper-plugin';
|
|
3
|
+
import pluginId from '../../pluginId';
|
|
4
4
|
import getTrad from '../../utils/getTrad';
|
|
5
5
|
|
|
6
6
|
const useReactQuery = () => {
|
|
7
7
|
const queryClient = useQueryClient();
|
|
8
8
|
const toggleNotification = useNotification();
|
|
9
|
-
const { isLoading, data } = useQuery('get-documentation', () =>
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const { isLoading, data } = useQuery(['get-documentation', pluginId], async () => {
|
|
10
|
+
try {
|
|
11
|
+
const { data } = await get(`/${pluginId}/getInfos`);
|
|
12
|
+
|
|
13
|
+
return data;
|
|
14
|
+
} catch (err) {
|
|
15
|
+
toggleNotification({
|
|
16
|
+
type: 'warning',
|
|
17
|
+
message: { id: 'notification.error' },
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// FIXME
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const { del, post, put, get } = useFetchClient();
|
|
12
26
|
|
|
13
27
|
const handleError = (err) => {
|
|
14
28
|
toggleNotification({
|
|
@@ -25,20 +39,26 @@ const useReactQuery = () => {
|
|
|
25
39
|
});
|
|
26
40
|
};
|
|
27
41
|
|
|
28
|
-
const deleteMutation = useMutation(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
const deleteMutation = useMutation(
|
|
43
|
+
({ prefix, version }) => del(`${prefix}/deleteDoc/${version}`),
|
|
44
|
+
{
|
|
45
|
+
onSuccess: () => handleSuccess('info', 'notification.delete.success'),
|
|
46
|
+
onError: (error) => handleError(error),
|
|
47
|
+
}
|
|
48
|
+
);
|
|
32
49
|
|
|
33
|
-
const submitMutation = useMutation(updateSettings, {
|
|
50
|
+
const submitMutation = useMutation(({ prefix, body }) => put(`${prefix}/updateSettings`, body), {
|
|
34
51
|
onSuccess: () => handleSuccess('success', 'notification.update.success'),
|
|
35
52
|
onError: handleError,
|
|
36
53
|
});
|
|
37
54
|
|
|
38
|
-
const regenerateDocMutation = useMutation(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
const regenerateDocMutation = useMutation(
|
|
56
|
+
({ prefix, version }) => post(`${prefix}/regenerateDoc`, { version }),
|
|
57
|
+
{
|
|
58
|
+
onSuccess: () => handleSuccess('info', 'notification.generate.success'),
|
|
59
|
+
onError: (error) => handleError(error),
|
|
60
|
+
}
|
|
61
|
+
);
|
|
42
62
|
|
|
43
63
|
return { data, isLoading, deleteMutation, submitMutation, regenerateDocMutation };
|
|
44
64
|
};
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-documentation",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.1-experimental.0",
|
|
4
4
|
"description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,17 +21,19 @@
|
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"lint": "run -T eslint ."
|
|
24
|
+
"lint": "run -T eslint .",
|
|
25
|
+
"test:unit": "jest --verbose"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@strapi/design-system": "1.6.6",
|
|
28
|
-
"@strapi/helper-plugin": "4.10.
|
|
29
|
+
"@strapi/helper-plugin": "4.10.1-experimental.0",
|
|
29
30
|
"@strapi/icons": "1.6.6",
|
|
30
|
-
"@strapi/utils": "4.10.
|
|
31
|
+
"@strapi/utils": "4.10.1-experimental.0",
|
|
31
32
|
"bcryptjs": "2.4.3",
|
|
32
33
|
"cheerio": "^1.0.0-rc.12",
|
|
33
34
|
"formik": "2.2.9",
|
|
34
35
|
"fs-extra": "10.0.0",
|
|
36
|
+
"immer": "9.0.19",
|
|
35
37
|
"koa-static": "^5.0.0",
|
|
36
38
|
"lodash": "4.17.21",
|
|
37
39
|
"path-to-regexp": "6.2.1",
|
|
@@ -55,6 +57,7 @@
|
|
|
55
57
|
"styled-components": "^5.3.3"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
60
|
+
"@apidevtools/swagger-parser": "^10.1.0",
|
|
58
61
|
"@testing-library/react": "12.1.4",
|
|
59
62
|
"history": "^4.9.0",
|
|
60
63
|
"msw": "1.0.1",
|
|
@@ -73,5 +76,5 @@
|
|
|
73
76
|
"description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
|
|
74
77
|
"kind": "plugin"
|
|
75
78
|
},
|
|
76
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "ce60415a0779e850da2c2edd80799f98918c000c"
|
|
77
80
|
}
|
|
@@ -19,9 +19,8 @@ module.exports = {
|
|
|
19
19
|
},
|
|
20
20
|
'x-strapi-config': {
|
|
21
21
|
path: '/documentation',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
plugins: ['email', 'upload', 'users-permissions'],
|
|
22
|
+
plugins: null,
|
|
23
|
+
mutateDocumentation: null,
|
|
25
24
|
},
|
|
26
25
|
servers: [],
|
|
27
26
|
externalDocs: {
|
|
@@ -33,42 +32,4 @@ module.exports = {
|
|
|
33
32
|
bearerAuth: [],
|
|
34
33
|
},
|
|
35
34
|
],
|
|
36
|
-
components: {
|
|
37
|
-
securitySchemes: {
|
|
38
|
-
bearerAuth: {
|
|
39
|
-
type: 'http',
|
|
40
|
-
scheme: 'bearer',
|
|
41
|
-
bearerFormat: 'JWT',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
schemas: {
|
|
45
|
-
Error: {
|
|
46
|
-
type: 'object',
|
|
47
|
-
required: ['error'],
|
|
48
|
-
properties: {
|
|
49
|
-
data: {
|
|
50
|
-
nullable: true,
|
|
51
|
-
oneOf: [{ type: 'object' }, { type: 'array', items: [] }],
|
|
52
|
-
},
|
|
53
|
-
error: {
|
|
54
|
-
type: 'object',
|
|
55
|
-
properties: {
|
|
56
|
-
status: {
|
|
57
|
-
type: 'integer',
|
|
58
|
-
},
|
|
59
|
-
name: {
|
|
60
|
-
type: 'string',
|
|
61
|
-
},
|
|
62
|
-
message: {
|
|
63
|
-
type: 'string',
|
|
64
|
-
},
|
|
65
|
-
details: {
|
|
66
|
-
type: 'object',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
35
|
};
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
'plugin::upload.file': {
|
|
5
|
+
collectionName: 'files',
|
|
6
|
+
info: { singularName: 'file', pluralName: 'files', displayName: 'File', description: '' },
|
|
7
|
+
options: {},
|
|
8
|
+
pluginOptions: {
|
|
9
|
+
'content-manager': { visible: false },
|
|
10
|
+
'content-type-builder': { visible: false },
|
|
11
|
+
},
|
|
12
|
+
attributes: {
|
|
13
|
+
name: { type: 'string', configurable: false, required: true },
|
|
14
|
+
alternativeText: { type: 'string', configurable: false },
|
|
15
|
+
caption: { type: 'string', configurable: false },
|
|
16
|
+
width: { type: 'integer', configurable: false },
|
|
17
|
+
height: { type: 'integer', configurable: false },
|
|
18
|
+
formats: { type: 'json', configurable: false },
|
|
19
|
+
hash: { type: 'string', configurable: false, required: true },
|
|
20
|
+
ext: { type: 'string', configurable: false },
|
|
21
|
+
mime: { type: 'string', configurable: false, required: true },
|
|
22
|
+
size: { type: 'decimal', configurable: false, required: true },
|
|
23
|
+
url: { type: 'string', configurable: false, required: true },
|
|
24
|
+
previewUrl: { type: 'string', configurable: false },
|
|
25
|
+
provider: { type: 'string', configurable: false, required: true },
|
|
26
|
+
provider_metadata: { type: 'json', configurable: false },
|
|
27
|
+
related: { type: 'relation', relation: 'morphToMany', configurable: false },
|
|
28
|
+
folder: {
|
|
29
|
+
type: 'relation',
|
|
30
|
+
relation: 'manyToOne',
|
|
31
|
+
target: 'plugin::upload.folder',
|
|
32
|
+
inversedBy: 'files',
|
|
33
|
+
private: true,
|
|
34
|
+
},
|
|
35
|
+
folderPath: { type: 'string', min: 1, required: true, private: true },
|
|
36
|
+
createdAt: { type: 'datetime' },
|
|
37
|
+
updatedAt: { type: 'datetime' },
|
|
38
|
+
createdBy: {
|
|
39
|
+
type: 'relation',
|
|
40
|
+
relation: 'oneToOne',
|
|
41
|
+
target: 'admin::user',
|
|
42
|
+
configurable: false,
|
|
43
|
+
writable: false,
|
|
44
|
+
visible: false,
|
|
45
|
+
useJoinTable: false,
|
|
46
|
+
private: true,
|
|
47
|
+
},
|
|
48
|
+
updatedBy: {
|
|
49
|
+
type: 'relation',
|
|
50
|
+
relation: 'oneToOne',
|
|
51
|
+
target: 'admin::user',
|
|
52
|
+
configurable: false,
|
|
53
|
+
writable: false,
|
|
54
|
+
visible: false,
|
|
55
|
+
useJoinTable: false,
|
|
56
|
+
private: true,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
indexes: [
|
|
60
|
+
{ name: 'upload_files_folder_path_index', columns: ['folder_path'], type: null },
|
|
61
|
+
{ name: 'upload_files_created_at_index', columns: ['created_at'], type: null },
|
|
62
|
+
{ name: 'upload_files_updated_at_index', columns: ['updated_at'], type: null },
|
|
63
|
+
{ name: 'upload_files_name_index', columns: ['name'], type: null },
|
|
64
|
+
{ name: 'upload_files_size_index', columns: ['size'], type: null },
|
|
65
|
+
{ name: 'upload_files_ext_index', columns: ['ext'], type: null },
|
|
66
|
+
],
|
|
67
|
+
kind: 'collectionType',
|
|
68
|
+
modelType: 'contentType',
|
|
69
|
+
modelName: 'file',
|
|
70
|
+
connection: 'default',
|
|
71
|
+
uid: 'plugin::upload.file',
|
|
72
|
+
plugin: 'upload',
|
|
73
|
+
globalId: 'UploadFile',
|
|
74
|
+
},
|
|
75
|
+
'plugin::upload.folder': {
|
|
76
|
+
collectionName: 'upload_folders',
|
|
77
|
+
info: { singularName: 'folder', pluralName: 'folders', displayName: 'Folder' },
|
|
78
|
+
options: {},
|
|
79
|
+
pluginOptions: {
|
|
80
|
+
'content-manager': { visible: false },
|
|
81
|
+
'content-type-builder': { visible: false },
|
|
82
|
+
},
|
|
83
|
+
attributes: {
|
|
84
|
+
name: { type: 'string', min: 1, required: true },
|
|
85
|
+
pathId: { type: 'integer', unique: true, required: true },
|
|
86
|
+
parent: {
|
|
87
|
+
type: 'relation',
|
|
88
|
+
relation: 'manyToOne',
|
|
89
|
+
target: 'plugin::upload.folder',
|
|
90
|
+
inversedBy: 'children',
|
|
91
|
+
},
|
|
92
|
+
children: {
|
|
93
|
+
type: 'relation',
|
|
94
|
+
relation: 'oneToMany',
|
|
95
|
+
target: 'plugin::upload.folder',
|
|
96
|
+
mappedBy: 'parent',
|
|
97
|
+
},
|
|
98
|
+
files: {
|
|
99
|
+
type: 'relation',
|
|
100
|
+
relation: 'oneToMany',
|
|
101
|
+
target: 'plugin::upload.file',
|
|
102
|
+
mappedBy: 'folder',
|
|
103
|
+
},
|
|
104
|
+
path: { type: 'string', min: 1, required: true },
|
|
105
|
+
createdAt: { type: 'datetime' },
|
|
106
|
+
updatedAt: { type: 'datetime' },
|
|
107
|
+
createdBy: {
|
|
108
|
+
type: 'relation',
|
|
109
|
+
relation: 'oneToOne',
|
|
110
|
+
target: 'admin::user',
|
|
111
|
+
configurable: false,
|
|
112
|
+
writable: false,
|
|
113
|
+
visible: false,
|
|
114
|
+
useJoinTable: false,
|
|
115
|
+
private: true,
|
|
116
|
+
},
|
|
117
|
+
updatedBy: {
|
|
118
|
+
type: 'relation',
|
|
119
|
+
relation: 'oneToOne',
|
|
120
|
+
target: 'admin::user',
|
|
121
|
+
configurable: false,
|
|
122
|
+
writable: false,
|
|
123
|
+
visible: false,
|
|
124
|
+
useJoinTable: false,
|
|
125
|
+
private: true,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
indexes: [
|
|
129
|
+
{ name: 'upload_folders_path_id_index', columns: ['path_id'], type: 'unique' },
|
|
130
|
+
{ name: 'upload_folders_path_index', columns: ['path'], type: 'unique' },
|
|
131
|
+
],
|
|
132
|
+
kind: 'collectionType',
|
|
133
|
+
modelType: 'contentType',
|
|
134
|
+
modelName: 'folder',
|
|
135
|
+
connection: 'default',
|
|
136
|
+
uid: 'plugin::upload.folder',
|
|
137
|
+
plugin: 'upload',
|
|
138
|
+
globalId: 'UploadFolder',
|
|
139
|
+
},
|
|
140
|
+
'api::kitchensink.kitchensink': {
|
|
141
|
+
kind: 'collectionType',
|
|
142
|
+
collectionName: 'kitchensinks',
|
|
143
|
+
info: {
|
|
144
|
+
displayName: 'Kitchen Sink',
|
|
145
|
+
singularName: 'kitchensink',
|
|
146
|
+
pluralName: 'kitchensinks',
|
|
147
|
+
description: '',
|
|
148
|
+
name: 'Kitchen Sink',
|
|
149
|
+
},
|
|
150
|
+
options: { draftAndPublish: true },
|
|
151
|
+
pluginOptions: {},
|
|
152
|
+
attributes: {
|
|
153
|
+
short_text: { type: 'string' },
|
|
154
|
+
long_text: { type: 'text' },
|
|
155
|
+
rich_text: { type: 'richtext' },
|
|
156
|
+
integer: { type: 'integer' },
|
|
157
|
+
biginteger: { type: 'biginteger' },
|
|
158
|
+
decimal: { type: 'decimal' },
|
|
159
|
+
float: { type: 'float' },
|
|
160
|
+
date: { type: 'date' },
|
|
161
|
+
datetime: { type: 'datetime' },
|
|
162
|
+
time: { type: 'time' },
|
|
163
|
+
timestamp: { type: 'timestamp' },
|
|
164
|
+
boolean: { type: 'boolean' },
|
|
165
|
+
email: { type: 'email' },
|
|
166
|
+
password: { type: 'password' },
|
|
167
|
+
enumeration: { type: 'enumeration', enum: ['A', 'B', 'C', 'D', 'E'] },
|
|
168
|
+
single_media: {
|
|
169
|
+
type: 'media',
|
|
170
|
+
multiple: false,
|
|
171
|
+
required: false,
|
|
172
|
+
allowedTypes: ['images', 'files', 'videos'],
|
|
173
|
+
},
|
|
174
|
+
multiple_media: {
|
|
175
|
+
type: 'media',
|
|
176
|
+
multiple: true,
|
|
177
|
+
required: false,
|
|
178
|
+
allowedTypes: ['images', 'files', 'videos'],
|
|
179
|
+
},
|
|
180
|
+
json: { type: 'json' },
|
|
181
|
+
single_compo: { type: 'component', repeatable: false, component: 'basic.simple' },
|
|
182
|
+
repeatable_compo: { type: 'component', repeatable: true, component: 'basic.simple' },
|
|
183
|
+
dynamiczone: { type: 'dynamiczone', components: ['basic.simple', 'blog.test-como'] },
|
|
184
|
+
one_way_tag: { type: 'relation', relation: 'oneToOne', target: 'api::tag.tag' },
|
|
185
|
+
one_to_one_tag: {
|
|
186
|
+
type: 'relation',
|
|
187
|
+
relation: 'oneToOne',
|
|
188
|
+
target: 'api::tag.tag',
|
|
189
|
+
private: true,
|
|
190
|
+
inversedBy: 'one_to_one_kitchensink',
|
|
191
|
+
},
|
|
192
|
+
one_to_many_tags: {
|
|
193
|
+
type: 'relation',
|
|
194
|
+
relation: 'oneToMany',
|
|
195
|
+
target: 'api::tag.tag',
|
|
196
|
+
mappedBy: 'many_to_one_kitchensink',
|
|
197
|
+
},
|
|
198
|
+
many_to_one_tag: {
|
|
199
|
+
type: 'relation',
|
|
200
|
+
relation: 'manyToOne',
|
|
201
|
+
target: 'api::tag.tag',
|
|
202
|
+
inversedBy: 'one_to_many_kitchensinks',
|
|
203
|
+
},
|
|
204
|
+
many_to_many_tags: {
|
|
205
|
+
type: 'relation',
|
|
206
|
+
relation: 'manyToMany',
|
|
207
|
+
target: 'api::tag.tag',
|
|
208
|
+
inversedBy: 'many_to_many_kitchensinks',
|
|
209
|
+
},
|
|
210
|
+
many_way_tags: { type: 'relation', relation: 'oneToMany', target: 'api::tag.tag' },
|
|
211
|
+
morph_to_one: { type: 'relation', relation: 'morphToOne' },
|
|
212
|
+
morph_to_many: { type: 'relation', relation: 'morphToMany' },
|
|
213
|
+
custom_field: { type: 'string', customField: 'plugin::color-picker.color' },
|
|
214
|
+
custom_field_with_default_options: {
|
|
215
|
+
type: 'string',
|
|
216
|
+
regex: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',
|
|
217
|
+
customField: 'plugin::color-picker.color',
|
|
218
|
+
},
|
|
219
|
+
cats: { type: 'dynamiczone', components: ['basic.relation', 'basic.simple'] },
|
|
220
|
+
createdAt: { type: 'datetime' },
|
|
221
|
+
updatedAt: { type: 'datetime' },
|
|
222
|
+
publishedAt: { type: 'datetime', configurable: false, writable: true, visible: false },
|
|
223
|
+
createdBy: {
|
|
224
|
+
type: 'relation',
|
|
225
|
+
relation: 'oneToOne',
|
|
226
|
+
target: 'admin::user',
|
|
227
|
+
configurable: false,
|
|
228
|
+
writable: false,
|
|
229
|
+
visible: false,
|
|
230
|
+
useJoinTable: false,
|
|
231
|
+
private: true,
|
|
232
|
+
},
|
|
233
|
+
updatedBy: {
|
|
234
|
+
type: 'relation',
|
|
235
|
+
relation: 'oneToOne',
|
|
236
|
+
target: 'admin::user',
|
|
237
|
+
configurable: false,
|
|
238
|
+
writable: false,
|
|
239
|
+
visible: false,
|
|
240
|
+
useJoinTable: false,
|
|
241
|
+
private: true,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
modelType: 'contentType',
|
|
245
|
+
modelName: 'kitchensink',
|
|
246
|
+
connection: 'default',
|
|
247
|
+
uid: 'api::kitchensink.kitchensink',
|
|
248
|
+
apiName: 'kitchensink',
|
|
249
|
+
globalId: 'Kitchensink',
|
|
250
|
+
actions: {},
|
|
251
|
+
lifecycles: {},
|
|
252
|
+
},
|
|
253
|
+
'api::homepage.homepage': {
|
|
254
|
+
kind: 'singleType',
|
|
255
|
+
collectionName: 'homepages',
|
|
256
|
+
info: { displayName: 'Homepage', singularName: 'homepage', pluralName: 'homepages' },
|
|
257
|
+
options: { draftAndPublish: true },
|
|
258
|
+
pluginOptions: { i18n: { localized: true } },
|
|
259
|
+
attributes: {
|
|
260
|
+
title: { type: 'string', required: true, pluginOptions: { i18n: { localized: true } } },
|
|
261
|
+
slug: {
|
|
262
|
+
type: 'uid',
|
|
263
|
+
targetField: 'title',
|
|
264
|
+
required: true,
|
|
265
|
+
pluginOptions: { i18n: { localized: true } },
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const contentTypes = require('./mock-content-types');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
contentTypes,
|
|
7
|
+
components: {
|
|
8
|
+
'basic.simple': {
|
|
9
|
+
collectionName: 'components_basic_simples',
|
|
10
|
+
info: { displayName: 'simple', icon: 'ambulance', description: '' },
|
|
11
|
+
options: {},
|
|
12
|
+
attributes: { name: { type: 'string', required: true }, test: { type: 'string' } },
|
|
13
|
+
uid: 'basic.simple',
|
|
14
|
+
category: 'basic',
|
|
15
|
+
modelType: 'component',
|
|
16
|
+
modelName: 'simple',
|
|
17
|
+
globalId: 'ComponentBasicSimple',
|
|
18
|
+
},
|
|
19
|
+
'blog.test-como': {
|
|
20
|
+
collectionName: 'components_blog_test_comos',
|
|
21
|
+
info: { displayName: 'test comp', icon: 'air-freshener', description: '' },
|
|
22
|
+
options: {},
|
|
23
|
+
attributes: { name: { type: 'string', default: 'toto' } },
|
|
24
|
+
uid: 'blog.test-como',
|
|
25
|
+
category: 'blog',
|
|
26
|
+
modelType: 'component',
|
|
27
|
+
modelName: 'test-como',
|
|
28
|
+
globalId: 'ComponentBlogTestComo',
|
|
29
|
+
},
|
|
30
|
+
'basic.relation': {
|
|
31
|
+
collectionName: 'components_basic_relations',
|
|
32
|
+
info: { displayName: 'Relation' },
|
|
33
|
+
options: {},
|
|
34
|
+
attributes: {
|
|
35
|
+
categories: { type: 'relation', relation: 'oneToMany', target: 'api::category.category' },
|
|
36
|
+
},
|
|
37
|
+
uid: 'basic.relation',
|
|
38
|
+
category: 'basic',
|
|
39
|
+
modelType: 'component',
|
|
40
|
+
modelName: 'relation',
|
|
41
|
+
globalId: 'ComponentBasicRelation',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
plugins: {
|
|
45
|
+
upload: {
|
|
46
|
+
contentTypes: {
|
|
47
|
+
file: contentTypes['plugin::upload.file'],
|
|
48
|
+
folder: contentTypes['plugin::upload.folder'],
|
|
49
|
+
},
|
|
50
|
+
routes: {
|
|
51
|
+
'content-api': {
|
|
52
|
+
type: 'content-api',
|
|
53
|
+
routes: [
|
|
54
|
+
{
|
|
55
|
+
method: 'POST',
|
|
56
|
+
path: '/',
|
|
57
|
+
handler: 'content-api.upload',
|
|
58
|
+
config: { auth: { scope: ['plugin::upload.content-api.upload'] } },
|
|
59
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
method: 'GET',
|
|
63
|
+
path: '/files',
|
|
64
|
+
handler: 'content-api.find',
|
|
65
|
+
config: { auth: { scope: ['plugin::upload.content-api.find'] } },
|
|
66
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
method: 'GET',
|
|
70
|
+
path: '/files/:id',
|
|
71
|
+
handler: 'content-api.findOne',
|
|
72
|
+
config: { auth: { scope: ['plugin::upload.content-api.findOne'] } },
|
|
73
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
method: 'DELETE',
|
|
77
|
+
path: '/files/:id',
|
|
78
|
+
handler: 'content-api.destroy',
|
|
79
|
+
config: { auth: { scope: ['plugin::upload.content-api.destroy'] } },
|
|
80
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
prefix: '/upload',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
email: {
|
|
88
|
+
contentTypes: {},
|
|
89
|
+
},
|
|
90
|
+
'users-permissions': {
|
|
91
|
+
contentTypes: {},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
api: {
|
|
95
|
+
homepage: {
|
|
96
|
+
contentTypes: {
|
|
97
|
+
homepage: contentTypes['api::homepage.homepage'],
|
|
98
|
+
},
|
|
99
|
+
routes: {
|
|
100
|
+
homepage: {
|
|
101
|
+
type: 'content-api',
|
|
102
|
+
routes: [
|
|
103
|
+
{
|
|
104
|
+
method: 'GET',
|
|
105
|
+
path: '/homepage',
|
|
106
|
+
handler: 'api::homepage.homepage.find',
|
|
107
|
+
config: { auth: { scope: ['api::homepage.homepage.find'] } },
|
|
108
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
method: 'PUT',
|
|
112
|
+
path: '/homepage',
|
|
113
|
+
handler: 'api::homepage.homepage.update',
|
|
114
|
+
config: { auth: { scope: ['api::homepage.homepage.update'] } },
|
|
115
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
method: 'DELETE',
|
|
119
|
+
path: '/homepage',
|
|
120
|
+
handler: 'api::homepage.homepage.delete',
|
|
121
|
+
config: { auth: { scope: ['api::homepage.homepage.delete'] } },
|
|
122
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
method: 'POST',
|
|
126
|
+
path: '/homepage',
|
|
127
|
+
handler: 'api::homepage.homepage.create',
|
|
128
|
+
config: { auth: { scope: ['api::homepage.homepage.create'] } },
|
|
129
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
kitchensink: {
|
|
136
|
+
contentTypes: {
|
|
137
|
+
kitchensink: contentTypes['api::kitchensink.kitchensink'],
|
|
138
|
+
},
|
|
139
|
+
routes: {
|
|
140
|
+
kitchensink: {
|
|
141
|
+
routes: [
|
|
142
|
+
{
|
|
143
|
+
method: 'GET',
|
|
144
|
+
path: '/kitchensinks',
|
|
145
|
+
handler: 'api::kitchensink.kitchensink.find',
|
|
146
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.find'] } },
|
|
147
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
method: 'GET',
|
|
151
|
+
path: '/kitchensinks/:id',
|
|
152
|
+
handler: 'api::kitchensink.kitchensink.findOne',
|
|
153
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.findOne'] } },
|
|
154
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
method: 'POST',
|
|
158
|
+
path: '/kitchensinks',
|
|
159
|
+
handler: 'api::kitchensink.kitchensink.create',
|
|
160
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.create'] } },
|
|
161
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
method: 'PUT',
|
|
165
|
+
path: '/kitchensinks/:id',
|
|
166
|
+
handler: 'api::kitchensink.kitchensink.update',
|
|
167
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.update'] } },
|
|
168
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
method: 'DELETE',
|
|
172
|
+
path: '/kitchensinks/:id',
|
|
173
|
+
handler: 'api::kitchensink.kitchensink.delete',
|
|
174
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.delete'] } },
|
|
175
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
type: 'content-api',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|