@localazy/strapi-plugin 0.1.11-rc.0 → 0.1.11-rc.1

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.
Files changed (31) hide show
  1. package/admin/src/modules/plugin-settings/components/ContentTransferSetup/index.js +5 -0
  2. package/admin/src/modules/plugin-settings/components/Tree/index.js +21 -6
  3. package/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.js +1 -1
  4. package/admin/src/modules/plugin-settings/functions/has-model-changed.js +1 -1
  5. package/admin/src/modules/plugin-settings/locale/en.js +1 -1
  6. package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +1 -7
  7. package/admin/src/modules/plugin-settings/utils/get-models-tree.js +19 -3
  8. package/package.json +4 -4
  9. package/server/controllers/localazy-transfer-controller.js +27 -7
  10. package/server/functions/should-set-downloaded-property.js +48 -3
  11. package/server/services/strapi-i18n-service.js +1 -1
  12. package/server/services/strapi-localazy-i18n-service.js +1 -1
  13. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-lesson-dz.js +392 -0
  14. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-sample-json-dz.js +4675 -0
  15. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz.js +309 -0
  16. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz.js +884 -0
  17. package/server/tests/fixtures/strapi-plugin-all-models.js +844 -37
  18. package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +211 -62
  19. package/server/utils/__tests__/pick-entries.test.js +936 -56
  20. package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +287 -0
  21. package/server/utils/build-populate.js +5 -0
  22. package/server/utils/model-utils.js +5 -0
  23. package/server/utils/omit-deep.js +7 -0
  24. package/server/utils/parsed-localazy-entry-to-create-entry.js +58 -4
  25. package/server/utils/parsed-localazy-entry-to-update-entry.js +6 -1
  26. package/server/utils/pick-deep.js +22 -0
  27. package/server/utils/pick-entries.js +90 -5
  28. package/server/utils/populate-create-update-entry-with-base-entry.js +51 -3
  29. package/server/tests/fixtures/collection-flattened.js +0 -76
  30. package/server/tests/fixtures/restaurant-flattened.js +0 -46
  31. package/server/tests/fixtures/restaurants-pick-paths.js +0 -15
@@ -0,0 +1,309 @@
1
+ "use strict";
2
+
3
+ const updateEntry = {
4
+ id: 4,
5
+ title: "Test: Sčítání",
6
+ start_time: "2022-10-01T13:00:00.000Z",
7
+ duration: "02:00:00.000",
8
+ description: "Otestujte si své dovednosti, které jsme se naučili v předchozí lekci.",
9
+ lesson_type: [
10
+ {
11
+ id: 2,
12
+ title: "Vyberte správnou odpověď",
13
+ questions: [
14
+ {
15
+ id: 4,
16
+ question: "1 + 1 = ",
17
+ is_active: true,
18
+ question_number: 1,
19
+ },
20
+ {
21
+ id: 5,
22
+ question: "5 + 15 = ",
23
+ is_active: false,
24
+ question_number: 2,
25
+ },
26
+ {
27
+ id: 6,
28
+ question: "Kolik pohárů je na fotce?",
29
+ is_active: false,
30
+ question_number: 3,
31
+ },
32
+ ],
33
+ answers: [
34
+ {
35
+ id: 4,
36
+ question_number: 1,
37
+ correct_answer: "2",
38
+ },
39
+ {
40
+ id: 5,
41
+ question_number: 2,
42
+ correct_answer: "20",
43
+ },
44
+ {
45
+ id: 6,
46
+ question_number: 3,
47
+ correct_answer: "15",
48
+ },
49
+ ],
50
+ __component: "lesson.quiz",
51
+ },
52
+ ],
53
+ };
54
+
55
+ // filtered baseEntry
56
+ const baseEntry = {
57
+ id: 2,
58
+ title: "Test: Addition",
59
+ start_time: "2022-10-01T13:00:00.000Z",
60
+ duration: "02:00:00.000",
61
+ description: "Test your skills we've learnt in the previous lesson.",
62
+ lesson_type: [
63
+ {
64
+ __component: "lesson.quiz",
65
+ id: 1,
66
+ title: "Choose the correct answer",
67
+ questions: [
68
+ {
69
+ id: 1,
70
+ question: "1 + 1 = ",
71
+ is_active: true,
72
+ question_number: 1,
73
+ assets: null,
74
+ },
75
+ {
76
+ id: 2,
77
+ question: "5 + 15 = ",
78
+ is_active: false,
79
+ question_number: 2,
80
+ assets: null,
81
+ },
82
+ {
83
+ id: 3,
84
+ question: "How many cups are on the photo?",
85
+ is_active: false,
86
+ question_number: 3,
87
+ assets: [
88
+ {
89
+ id: 13,
90
+ name: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
91
+ alternativeText: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
92
+ caption: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
93
+ width: 3360,
94
+ height: 5040,
95
+ formats: {
96
+ thumbnail: {
97
+ name: "thumbnail_lidya-nada-BnzqQwerUOY-unsplash.jpg",
98
+ hash: "thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
99
+ ext: ".jpg",
100
+ mime: "image/jpeg",
101
+ path: null,
102
+ width: 104,
103
+ height: 156,
104
+ size: 2.59,
105
+ url: "/uploads/thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
106
+ },
107
+ large: {
108
+ name: "large_lidya-nada-BnzqQwerUOY-unsplash.jpg",
109
+ hash: "large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
110
+ ext: ".jpg",
111
+ mime: "image/jpeg",
112
+ path: null,
113
+ width: 667,
114
+ height: 1000,
115
+ size: 38.91,
116
+ url: "/uploads/large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
117
+ },
118
+ medium: {
119
+ name: "medium_lidya-nada-BnzqQwerUOY-unsplash.jpg",
120
+ hash: "medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
121
+ ext: ".jpg",
122
+ mime: "image/jpeg",
123
+ path: null,
124
+ width: 500,
125
+ height: 750,
126
+ size: 24.62,
127
+ url: "/uploads/medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
128
+ },
129
+ small: {
130
+ name: "small_lidya-nada-BnzqQwerUOY-unsplash.jpg",
131
+ hash: "small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
132
+ ext: ".jpg",
133
+ mime: "image/jpeg",
134
+ path: null,
135
+ width: 333,
136
+ height: 500,
137
+ size: 12.98,
138
+ url: "/uploads/small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
139
+ },
140
+ },
141
+ hash: "lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
142
+ ext: ".jpg",
143
+ mime: "image/jpeg",
144
+ size: 1536.82,
145
+ url: "/uploads/lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
146
+ previewUrl: null,
147
+ provider: "local",
148
+ provider_metadata: null,
149
+ },
150
+ ],
151
+ },
152
+ ],
153
+ answers: [
154
+ {
155
+ id: 1,
156
+ question_number: 1,
157
+ correct_answer: "2",
158
+ answer_asset: null,
159
+ },
160
+ {
161
+ id: 2,
162
+ question_number: 2,
163
+ correct_answer: "20",
164
+ answer_asset: null,
165
+ },
166
+ {
167
+ id: 3,
168
+ question_number: 3,
169
+ correct_answer: "15",
170
+ answer_asset: null,
171
+ },
172
+ ],
173
+ },
174
+ ],
175
+ };
176
+
177
+ // filtered fullyPopulatedLocalizedEntry
178
+ const fullyPopulatedLocalizedEntry = {
179
+ id: 4,
180
+ title: "Test: Sčítání",
181
+ start_time: "2022-10-01T13:00:00.000Z",
182
+ duration: "02:00:00.000",
183
+ description: "Otestujte si své dovednosti, které jsme se naučili v předchozí lekci.",
184
+ lesson_type: [
185
+ {
186
+ __component: "lesson.quiz",
187
+ id: 2,
188
+ title: "Vyberte správnou odpověď",
189
+ questions: [
190
+ {
191
+ id: 4,
192
+ question: "1 + 1 = ",
193
+ is_active: true,
194
+ question_number: 1,
195
+ assets: null,
196
+ },
197
+ {
198
+ id: 5,
199
+ question: "5 + 15 = ",
200
+ is_active: false,
201
+ question_number: 2,
202
+ assets: null,
203
+ },
204
+ {
205
+ id: 6,
206
+ question: "Kolik pohárů je na fotce?",
207
+ is_active: false,
208
+ question_number: 3,
209
+ assets: [
210
+ {
211
+ id: 13,
212
+ name: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
213
+ alternativeText: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
214
+ caption: "lidya-nada-BnzqQwerUOY-unsplash.jpg",
215
+ width: 3360,
216
+ height: 5040,
217
+ formats: {
218
+ thumbnail: {
219
+ name: "thumbnail_lidya-nada-BnzqQwerUOY-unsplash.jpg",
220
+ hash: "thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
221
+ ext: ".jpg",
222
+ mime: "image/jpeg",
223
+ path: null,
224
+ width: 104,
225
+ height: 156,
226
+ size: 2.59,
227
+ url: "/uploads/thumbnail_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
228
+ },
229
+ large: {
230
+ name: "large_lidya-nada-BnzqQwerUOY-unsplash.jpg",
231
+ hash: "large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
232
+ ext: ".jpg",
233
+ mime: "image/jpeg",
234
+ path: null,
235
+ width: 667,
236
+ height: 1000,
237
+ size: 38.91,
238
+ url: "/uploads/large_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
239
+ },
240
+ medium: {
241
+ name: "medium_lidya-nada-BnzqQwerUOY-unsplash.jpg",
242
+ hash: "medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
243
+ ext: ".jpg",
244
+ mime: "image/jpeg",
245
+ path: null,
246
+ width: 500,
247
+ height: 750,
248
+ size: 24.62,
249
+ url: "/uploads/medium_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
250
+ },
251
+ small: {
252
+ name: "small_lidya-nada-BnzqQwerUOY-unsplash.jpg",
253
+ hash: "small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
254
+ ext: ".jpg",
255
+ mime: "image/jpeg",
256
+ path: null,
257
+ width: 333,
258
+ height: 500,
259
+ size: 12.98,
260
+ url: "/uploads/small_lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
261
+ },
262
+ },
263
+ hash: "lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12",
264
+ ext: ".jpg",
265
+ mime: "image/jpeg",
266
+ size: 1536.82,
267
+ url: "/uploads/lidya_nada_Bnzq_Qwer_UOY_unsplash_1c85b31b12.jpg",
268
+ previewUrl: null,
269
+ provider: "local",
270
+ provider_metadata: null,
271
+ },
272
+ ],
273
+ },
274
+ ],
275
+ answers: [
276
+ {
277
+ id: 4,
278
+ question_number: 1,
279
+ correct_answer: "2",
280
+ answer_asset: null,
281
+ },
282
+ {
283
+ id: 5,
284
+ question_number: 2,
285
+ correct_answer: "20",
286
+ answer_asset: null,
287
+ },
288
+ {
289
+ id: 6,
290
+ question_number: 3,
291
+ correct_answer: "15",
292
+ answer_asset: null,
293
+ },
294
+ ],
295
+ },
296
+ ],
297
+ };
298
+
299
+ const uid = "api::lesson.lesson";
300
+
301
+ const locale = "cs";
302
+
303
+ module.exports = {
304
+ updateEntry,
305
+ baseEntry,
306
+ fullyPopulatedLocalizedEntry,
307
+ uid,
308
+ locale,
309
+ }