@webresto/graphql 1.3.0 → 1.3.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/package.json +25 -8
- package/src/additionalResolvers.js +1 -1
- package/src/additionalResolvers.ts +1 -1
- package/src/graphql.js +40 -22
- package/src/graphql.ts +42 -25
- package/src/resolvers/cart.d.ts +229 -9
- package/src/resolvers/cart.js +27 -7
- package/src/resolvers/cart.ts +29 -8
- package/src/resolvers/checkout.ts +1 -0
- package/test/{_bootstrap.js → bootstrap.js} +6 -7
- package/test/bootstrap.ts +36 -0
- package/test/fixture/.sailsrc +14 -0
- package/test/{fixtures/v0.12-app → fixture}/api/controllers/.gitkeep +0 -0
- package/test/{fixtures/v0.12-app → fixture}/api/models/.gitkeep +0 -0
- package/test/{fixtures/v0.12-app → fixture}/api/services/.gitkeep +0 -0
- package/test/{fixtures/v0.12-app/app.js → fixture/app-export.js} +2 -2
- package/test/fixture/app.js +56 -0
- package/test/fixture/config/adminpanel.js +25 -0
- package/test/fixture/config/bootstrap.js +161 -0
- package/test/fixture/config/connections.js +9 -0
- package/test/fixture/config/env/development.js +10 -0
- package/test/{fixtures/v0.12-app → fixture}/config/env/production.js +5 -5
- package/test/fixture/config/globals.js +16 -0
- package/test/{fixtures/v0.12-app → fixture}/config/hookTimeout.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/http.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/i18n.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/log.js +1 -1
- package/test/fixture/config/models.js +9 -0
- package/test/fixture/config/modulemanager.js +22 -0
- package/test/{fixtures/v0.12-app → fixture}/config/policies.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/routes.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/session.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/sockets.js +0 -0
- package/test/{fixtures/v0.12-app → fixture}/config/views.js +0 -0
- package/test/fixture/hacks/waterline.js +39 -0
- package/test/fixture/package.json +33 -0
- package/test/fixture/seeds/dish.json +37042 -0
- package/test/fixture/seeds/group.json +1418 -0
- package/test/fixture/seeds/iikoDiscount.json +365 -0
- package/test/{fixtures/v0.12-app → fixture}/views/403.ejs +0 -0
- package/test/{fixtures/v0.12-app → fixture}/views/404.ejs +0 -0
- package/test/{fixtures/v0.12-app → fixture}/views/500.ejs +0 -0
- package/test/{fixtures/v0.12-app → fixture}/views/homepage.ejs +0 -0
- package/test/{fixtures/v0.12-app → fixture}/views/layout.ejs +0 -0
- package/test/integration/graphql.test.js +11 -0
- package/test/integration/graphql.test.ts +15 -0
- package/test/{unit → integration}/sails_not_crash.test.js +0 -0
- package/test/integration/sails_not_crash.test.ts +3 -0
- package/test/unit/first.test.js +6 -8
- package/test/unit/first.test.ts +11 -0
- package/test/fixtures/v0.12-app/.gitignore +0 -11
- package/test/fixtures/v0.12-app/.sailsrc +0 -11
- package/test/fixtures/v0.12-app/api/models/TestModel.js +0 -22
- package/test/fixtures/v0.12-app/api/responses/badRequest.js +0 -76
- package/test/fixtures/v0.12-app/api/responses/created.js +0 -60
- package/test/fixtures/v0.12-app/api/responses/forbidden.js +0 -89
- package/test/fixtures/v0.12-app/api/responses/notFound.js +0 -94
- package/test/fixtures/v0.12-app/api/responses/ok.js +0 -60
- package/test/fixtures/v0.12-app/api/responses/serverError.js +0 -89
- package/test/fixtures/v0.12-app/config/bootstrap.js +0 -6
- package/test/fixtures/v0.12-app/config/connections.js +0 -5
- package/test/fixtures/v0.12-app/config/cors.js +0 -78
- package/test/fixtures/v0.12-app/config/csrf.js +0 -64
- package/test/fixtures/v0.12-app/config/env/development.js +0 -10
- package/test/fixtures/v0.12-app/config/globals.js +0 -63
- package/test/fixtures/v0.12-app/config/models.js +0 -3
- package/test/fixtures/v0.12-app/config/restoapi.js +0 -3
- package/test/fixtures/v0.12-app/config/restocore.js +0 -39
- package/test/fixtures/v0.12-app/config/stateflow.js +0 -4
- package/test/fixtures/v0.12-app/package.json +0 -34
@@ -0,0 +1,365 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": "2b74fa7d-a31e-49c6-aad2-4b1bb95f6ccd",
|
4
|
+
"rmsId": "592722dd-5082-4cf9-980a-13f43b766123",
|
5
|
+
"name": "Скидка 10%",
|
6
|
+
"percent": 10,
|
7
|
+
"comment": "",
|
8
|
+
"mode": "PERCENT",
|
9
|
+
"sum": 0,
|
10
|
+
"isCategorisedDiscount": false,
|
11
|
+
"productCategoryDiscounts": [],
|
12
|
+
"canBeAppliedSelectively": true,
|
13
|
+
"minOrderSum": null,
|
14
|
+
"enable": false,
|
15
|
+
"order": null,
|
16
|
+
"isDeleted": false,
|
17
|
+
"isManual": true,
|
18
|
+
"isCard": false,
|
19
|
+
"canApplyByCardNumber": false,
|
20
|
+
"isAutomatic": false,
|
21
|
+
"workTime": null,
|
22
|
+
"createdAt": "2021-01-20T11:23:55.000Z",
|
23
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"id": "989a6856-5c7b-4cc8-881a-c9f1490f39c4",
|
27
|
+
"rmsId": "3db6e63a-3004-4046-9c0f-6a6d9b87c9d6",
|
28
|
+
"name": "Скидка 10% на ДР",
|
29
|
+
"percent": 10,
|
30
|
+
"comment": "",
|
31
|
+
"mode": "PERCENT",
|
32
|
+
"sum": 0,
|
33
|
+
"isCategorisedDiscount": false,
|
34
|
+
"productCategoryDiscounts": [],
|
35
|
+
"canBeAppliedSelectively": false,
|
36
|
+
"minOrderSum": null,
|
37
|
+
"enable": false,
|
38
|
+
"order": null,
|
39
|
+
"isDeleted": false,
|
40
|
+
"isManual": true,
|
41
|
+
"isCard": false,
|
42
|
+
"canApplyByCardNumber": false,
|
43
|
+
"isAutomatic": false,
|
44
|
+
"createdAt": "2021-01-20T11:23:55.000Z",
|
45
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"id": "b7b52a3f-2789-49a5-9a15-68c1fa89f4c7",
|
49
|
+
"rmsId": "6d75ef17-e622-49f9-afad-97ba6b6380fd",
|
50
|
+
"name": "Лови пиццу и сертификаты на пиццу",
|
51
|
+
"percent": 100,
|
52
|
+
"comment": "",
|
53
|
+
"mode": "PERCENT",
|
54
|
+
"sum": 0,
|
55
|
+
"isCategorisedDiscount": false,
|
56
|
+
"productCategoryDiscounts": [
|
57
|
+
{
|
58
|
+
"categoryId": "1483c868-aaf7-6a9b-0165-a31381241120",
|
59
|
+
"categoryName": "Пицца",
|
60
|
+
"percent": 100
|
61
|
+
}
|
62
|
+
],
|
63
|
+
"canBeAppliedSelectively": true,
|
64
|
+
"minOrderSum": null,
|
65
|
+
"enable": false,
|
66
|
+
"order": null,
|
67
|
+
"isDeleted": false,
|
68
|
+
"isManual": true,
|
69
|
+
"isCard": false,
|
70
|
+
"canApplyByCardNumber": false,
|
71
|
+
"isAutomatic": false,
|
72
|
+
"createdAt": "2021-01-20T11:23:55.000Z",
|
73
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"id": "2bff9526-7686-4baa-9a1c-3ba4fb6882bc",
|
77
|
+
"rmsId": "8cbf0507-295a-4074-b6ac-a12e424afcf1",
|
78
|
+
"name": "СКИДКА 15 %",
|
79
|
+
"percent": 15,
|
80
|
+
"comment": "",
|
81
|
+
"mode": "PERCENT",
|
82
|
+
"sum": 0,
|
83
|
+
"isCategorisedDiscount": false,
|
84
|
+
"productCategoryDiscounts": [],
|
85
|
+
"canBeAppliedSelectively": true,
|
86
|
+
"minOrderSum": null,
|
87
|
+
"enable": false,
|
88
|
+
"order": null,
|
89
|
+
"isDeleted": false,
|
90
|
+
"isManual": true,
|
91
|
+
"isCard": false,
|
92
|
+
"canApplyByCardNumber": false,
|
93
|
+
"isAutomatic": false,
|
94
|
+
"createdAt": "2021-12-17T11:16:03.000Z",
|
95
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"id": "3ad66c7f-7304-4c94-a4a1-1f21a2dc7c18",
|
99
|
+
"rmsId": "269302da-7e0f-4775-888a-c6c9640e5a71",
|
100
|
+
"name": "ПОДАРОК",
|
101
|
+
"percent": 100,
|
102
|
+
"comment": "",
|
103
|
+
"mode": "PERCENT",
|
104
|
+
"sum": 0,
|
105
|
+
"isCategorisedDiscount": false,
|
106
|
+
"productCategoryDiscounts": [],
|
107
|
+
"canBeAppliedSelectively": true,
|
108
|
+
"minOrderSum": 1500,
|
109
|
+
"enable": false,
|
110
|
+
"order": null,
|
111
|
+
"isDeleted": false,
|
112
|
+
"isManual": true,
|
113
|
+
"isCard": false,
|
114
|
+
"canApplyByCardNumber": false,
|
115
|
+
"isAutomatic": false,
|
116
|
+
"createdAt": "2021-02-05T06:44:00.000Z",
|
117
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"id": "2b3737ee-2419-4c58-b151-7947f51f2318",
|
121
|
+
"rmsId": "6668979c-658d-428b-9f85-c9f365208423",
|
122
|
+
"name": "Скидка 5%",
|
123
|
+
"percent": 5,
|
124
|
+
"comment": "",
|
125
|
+
"mode": "PERCENT",
|
126
|
+
"sum": 0,
|
127
|
+
"isCategorisedDiscount": false,
|
128
|
+
"productCategoryDiscounts": [],
|
129
|
+
"canBeAppliedSelectively": false,
|
130
|
+
"minOrderSum": null,
|
131
|
+
"enable": false,
|
132
|
+
"order": null,
|
133
|
+
"isDeleted": false,
|
134
|
+
"isManual": true,
|
135
|
+
"isCard": false,
|
136
|
+
"canApplyByCardNumber": false,
|
137
|
+
"isAutomatic": false,
|
138
|
+
"createdAt": "2021-01-20T11:23:55.000Z",
|
139
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
140
|
+
},
|
141
|
+
{
|
142
|
+
"id": "420f377c-ef3e-4d7f-b1b8-a3e0cc0f6ab2",
|
143
|
+
"rmsId": "eb462a00-39d5-4193-9829-d1dff5279efd",
|
144
|
+
"name": "Скидка 50% на кофе",
|
145
|
+
"percent": 50,
|
146
|
+
"comment": "",
|
147
|
+
"mode": "PERCENT",
|
148
|
+
"sum": 0,
|
149
|
+
"isCategorisedDiscount": true,
|
150
|
+
"productCategoryDiscounts": [
|
151
|
+
{
|
152
|
+
"categoryId": "8c89b763-10f4-432e-91a6-02740b524b3b",
|
153
|
+
"categoryName": "Кофе",
|
154
|
+
"percent": 50
|
155
|
+
}
|
156
|
+
],
|
157
|
+
"canBeAppliedSelectively": true,
|
158
|
+
"minOrderSum": null,
|
159
|
+
"enable": false,
|
160
|
+
"order": null,
|
161
|
+
"isDeleted": false,
|
162
|
+
"isManual": true,
|
163
|
+
"isCard": true,
|
164
|
+
"canApplyByCardNumber": false,
|
165
|
+
"isAutomatic": false,
|
166
|
+
"workTime": null,
|
167
|
+
"createdAt": "2022-01-19T11:56:05.000Z",
|
168
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"id": "b0892df7-a0f2-47c3-9b8c-574f4f0dea9f",
|
172
|
+
"rmsId": "11c58d76-9c2e-493f-a9ae-f1d5e240fd66",
|
173
|
+
"name": "Скидка 15% на др",
|
174
|
+
"percent": 15,
|
175
|
+
"comment": "",
|
176
|
+
"mode": "PERCENT",
|
177
|
+
"sum": 0,
|
178
|
+
"isCategorisedDiscount": false,
|
179
|
+
"productCategoryDiscounts": [],
|
180
|
+
"canBeAppliedSelectively": false,
|
181
|
+
"minOrderSum": null,
|
182
|
+
"enable": false,
|
183
|
+
"order": null,
|
184
|
+
"isDeleted": false,
|
185
|
+
"isManual": true,
|
186
|
+
"isCard": false,
|
187
|
+
"canApplyByCardNumber": false,
|
188
|
+
"isAutomatic": false,
|
189
|
+
"createdAt": "2021-01-20T11:23:55.000Z",
|
190
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"id": "c0139436-a6bb-4f2b-a43a-985330ad3a75",
|
194
|
+
"rmsId": "0e3eee14-f175-4d95-b0ff-fb17296eed6c",
|
195
|
+
"name": "Скидка 20%",
|
196
|
+
"percent": 20,
|
197
|
+
"comment": "",
|
198
|
+
"mode": "PERCENT",
|
199
|
+
"sum": 0,
|
200
|
+
"isCategorisedDiscount": false,
|
201
|
+
"productCategoryDiscounts": [],
|
202
|
+
"canBeAppliedSelectively": false,
|
203
|
+
"minOrderSum": null,
|
204
|
+
"enable": false,
|
205
|
+
"order": null,
|
206
|
+
"isDeleted": false,
|
207
|
+
"isManual": true,
|
208
|
+
"isCard": false,
|
209
|
+
"canApplyByCardNumber": false,
|
210
|
+
"isAutomatic": false,
|
211
|
+
"createdAt": "2021-01-20T11:23:55.000Z",
|
212
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"id": "bd60d07f-0503-43cc-a036-9050467e6f6c",
|
216
|
+
"rmsId": "05aecf09-9218-46aa-9efb-b0962cf0957d",
|
217
|
+
"name": "Скидка тест на самовывоз 10%",
|
218
|
+
"percent": 1,
|
219
|
+
"comment": "",
|
220
|
+
"mode": "PERCENT",
|
221
|
+
"sum": 0,
|
222
|
+
"isCategorisedDiscount": true,
|
223
|
+
"productCategoryDiscounts": [
|
224
|
+
{
|
225
|
+
"categoryId": "0e2f200b-3957-63fa-0165-65f55759e9d3",
|
226
|
+
"categoryName": "Кофе",
|
227
|
+
"percent": 10
|
228
|
+
}
|
229
|
+
],
|
230
|
+
"canBeAppliedSelectively": false,
|
231
|
+
"minOrderSum": null,
|
232
|
+
"enable": false,
|
233
|
+
"order": null,
|
234
|
+
"isDeleted": true,
|
235
|
+
"isManual": true,
|
236
|
+
"isCard": false,
|
237
|
+
"canApplyByCardNumber": false,
|
238
|
+
"isAutomatic": false,
|
239
|
+
"createdAt": "2022-03-22T07:51:08.000Z",
|
240
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
241
|
+
},
|
242
|
+
{
|
243
|
+
"id": "7667c821-6905-4f7c-9362-282e7b2699ed",
|
244
|
+
"rmsId": "b78a3fd5-d741-4b7c-af97-d3a66543358d",
|
245
|
+
"name": "Самовывоз 8%",
|
246
|
+
"percent": 8,
|
247
|
+
"comment": "",
|
248
|
+
"mode": "PERCENT",
|
249
|
+
"sum": 0,
|
250
|
+
"isCategorisedDiscount": false,
|
251
|
+
"productCategoryDiscounts": [],
|
252
|
+
"canBeAppliedSelectively": false,
|
253
|
+
"minOrderSum": null,
|
254
|
+
"enable": false,
|
255
|
+
"order": null,
|
256
|
+
"isDeleted": true,
|
257
|
+
"isManual": true,
|
258
|
+
"isCard": false,
|
259
|
+
"canApplyByCardNumber": false,
|
260
|
+
"isAutomatic": false,
|
261
|
+
"createdAt": "2021-10-25T11:51:02.000Z",
|
262
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
263
|
+
},
|
264
|
+
{
|
265
|
+
"id": "ae0ae11d-8344-43ed-8768-888ba39ab99d",
|
266
|
+
"rmsId": "5ee7a9cd-101c-4b88-bf65-518dbbe84b5b",
|
267
|
+
"name": "Скидка 100% на пиво",
|
268
|
+
"percent": 1,
|
269
|
+
"comment": "",
|
270
|
+
"mode": "PERCENT",
|
271
|
+
"sum": 0,
|
272
|
+
"isCategorisedDiscount": true,
|
273
|
+
"productCategoryDiscounts": [
|
274
|
+
{
|
275
|
+
"categoryId": "15e14acc-cf09-f0f4-0165-7aeee26b745e",
|
276
|
+
"categoryName": "Пиво",
|
277
|
+
"percent": 100
|
278
|
+
}
|
279
|
+
],
|
280
|
+
"canBeAppliedSelectively": true,
|
281
|
+
"minOrderSum": null,
|
282
|
+
"enable": false,
|
283
|
+
"order": null,
|
284
|
+
"isDeleted": true,
|
285
|
+
"isManual": true,
|
286
|
+
"isCard": false,
|
287
|
+
"canApplyByCardNumber": false,
|
288
|
+
"isAutomatic": false,
|
289
|
+
"createdAt": "2022-02-08T12:51:06.000Z",
|
290
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
291
|
+
},
|
292
|
+
{
|
293
|
+
"id": "790c3bb4-1786-4eb3-8d19-685a7d6d7373",
|
294
|
+
"rmsId": "072fffb3-e19f-4e21-83b1-ce38739bdbea",
|
295
|
+
"name": "САМОВЫВОЗ 10%",
|
296
|
+
"percent": 10,
|
297
|
+
"comment": "",
|
298
|
+
"mode": "PERCENT",
|
299
|
+
"sum": 0,
|
300
|
+
"isCategorisedDiscount": false,
|
301
|
+
"productCategoryDiscounts": [],
|
302
|
+
"canBeAppliedSelectively": false,
|
303
|
+
"minOrderSum": null,
|
304
|
+
"enable": false,
|
305
|
+
"order": null,
|
306
|
+
"isDeleted": false,
|
307
|
+
"isManual": true,
|
308
|
+
"isCard": false,
|
309
|
+
"canApplyByCardNumber": false,
|
310
|
+
"isAutomatic": false,
|
311
|
+
"createdAt": "2021-10-26T08:48:36.000Z",
|
312
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
"id": "b9fa8cbb-cbb5-4ea8-8424-14bd8ba5b0bb",
|
316
|
+
"rmsId": "127601c6-8c83-4474-b6e0-ff5e47947f77",
|
317
|
+
"name": "Тестовая самовывоз 5%",
|
318
|
+
"percent": 5,
|
319
|
+
"comment": "",
|
320
|
+
"mode": "PERCENT",
|
321
|
+
"sum": 0,
|
322
|
+
"isCategorisedDiscount": true,
|
323
|
+
"productCategoryDiscounts": [
|
324
|
+
{
|
325
|
+
"categoryId": "7c907b14-a4cb-4c54-92c0-140fb6a06d21",
|
326
|
+
"categoryName": "Десерты",
|
327
|
+
"percent": 5
|
328
|
+
}
|
329
|
+
],
|
330
|
+
"canBeAppliedSelectively": false,
|
331
|
+
"minOrderSum": null,
|
332
|
+
"enable": false,
|
333
|
+
"order": null,
|
334
|
+
"isDeleted": false,
|
335
|
+
"isManual": true,
|
336
|
+
"isCard": true,
|
337
|
+
"canApplyByCardNumber": false,
|
338
|
+
"isAutomatic": false,
|
339
|
+
"workTime": null,
|
340
|
+
"createdAt": "2022-04-04T08:56:07.000Z",
|
341
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
342
|
+
},
|
343
|
+
{
|
344
|
+
"id": "2e9e7be1-a365-46b7-b841-d3d7b8b01438",
|
345
|
+
"rmsId": "b7992c74-e6f3-4c30-b803-2af11aa766c2",
|
346
|
+
"name": "Тестовая скидка 2",
|
347
|
+
"percent": 1,
|
348
|
+
"comment": "",
|
349
|
+
"mode": "PERCENT",
|
350
|
+
"sum": 0,
|
351
|
+
"isCategorisedDiscount": false,
|
352
|
+
"productCategoryDiscounts": [],
|
353
|
+
"canBeAppliedSelectively": false,
|
354
|
+
"minOrderSum": null,
|
355
|
+
"enable": false,
|
356
|
+
"order": null,
|
357
|
+
"isDeleted": true,
|
358
|
+
"isManual": true,
|
359
|
+
"isCard": true,
|
360
|
+
"canApplyByCardNumber": false,
|
361
|
+
"isAutomatic": false,
|
362
|
+
"createdAt": "2021-10-08T11:46:05.000Z",
|
363
|
+
"updatedAt": "2022-04-28T17:31:08.000Z"
|
364
|
+
}
|
365
|
+
]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
const expect = require("chai").expect;
|
2
|
+
describe('GraphQl', function () {
|
3
|
+
it('Added fields exist in schema', async () => {
|
4
|
+
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
5
|
+
console.log(graphql);
|
6
|
+
const result = await graphql.getServer().executeOperation({
|
7
|
+
query: '{dish { id } \n group { id }}'
|
8
|
+
});
|
9
|
+
expect(result.errors).to.be.undefined;
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const expect = require("chai").expect;
|
2
|
+
|
3
|
+
describe('GraphQl', function () {
|
4
|
+
it('Added fields exist in schema', async () => {
|
5
|
+
|
6
|
+
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
7
|
+
console.log(graphql)
|
8
|
+
const result = await graphql.getServer().executeOperation({
|
9
|
+
query: '{dish { id } \n group { id }}'
|
10
|
+
});
|
11
|
+
expect(result.errors).to.be.undefined;
|
12
|
+
});
|
13
|
+
});
|
14
|
+
|
15
|
+
|
File without changes
|
package/test/unit/first.test.js
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
const expect = require("chai").expect;
|
2
|
-
|
3
2
|
describe('GraphQl', function () {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
});
|
3
|
+
it('schema exist', async () => {
|
4
|
+
// const data = await TestModel.find({});
|
5
|
+
// console.log(data);
|
6
|
+
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
7
|
+
expect(graphql.getServer().schema._typeMap.Dish != undefined);
|
8
|
+
});
|
11
9
|
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
const expect = require("chai").expect;
|
2
|
+
|
3
|
+
describe('GraphQl', function () {
|
4
|
+
it('schema exist', async () => {
|
5
|
+
// const data = await TestModel.find({});
|
6
|
+
// console.log(data);
|
7
|
+
|
8
|
+
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
9
|
+
expect(graphql.getServer().schema._typeMap.Dish != undefined);
|
10
|
+
});
|
11
|
+
});
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
module.exports = {
|
3
|
-
attributes: {
|
4
|
-
|
5
|
-
order_number : { type: 'string' },
|
6
|
-
|
7
|
-
order_id : { type: 'string' },
|
8
|
-
|
9
|
-
order_id: { type: 'string' },
|
10
|
-
|
11
|
-
phone : { type: 'string' },
|
12
|
-
|
13
|
-
notifyMethod : {
|
14
|
-
type: 'string'
|
15
|
-
},
|
16
|
-
|
17
|
-
delivered : {
|
18
|
-
type: 'json',
|
19
|
-
defaultsTo: {new: false}
|
20
|
-
},
|
21
|
-
},
|
22
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 400 (Bad Request) Handler
|
3
|
-
*
|
4
|
-
* Usage:
|
5
|
-
* return res.badRequest();
|
6
|
-
* return res.badRequest(data);
|
7
|
-
* return res.badRequest(data, 'some/specific/badRequest/view');
|
8
|
-
*
|
9
|
-
* e.g.:
|
10
|
-
* ```
|
11
|
-
* return res.badRequest(
|
12
|
-
* 'Please choose a valid `password` (6-12 characters)',
|
13
|
-
* 'trial/signup'
|
14
|
-
* );
|
15
|
-
* ```
|
16
|
-
*/
|
17
|
-
|
18
|
-
module.exports = function badRequest(data, options) {
|
19
|
-
|
20
|
-
// Get access to `req`, `res`, & `sails`
|
21
|
-
var req = this.req;
|
22
|
-
var res = this.res;
|
23
|
-
var sails = req._sails;
|
24
|
-
|
25
|
-
// Set status code
|
26
|
-
res.status(400);
|
27
|
-
|
28
|
-
// Log error to console
|
29
|
-
if (data !== undefined) {
|
30
|
-
sails.log.verbose('Sending 400 ("Bad Request") response: \n',data);
|
31
|
-
}
|
32
|
-
else sails.log.verbose('Sending 400 ("Bad Request") response');
|
33
|
-
|
34
|
-
// Only include errors in response if application environment
|
35
|
-
// is not set to 'production'. In production, we shouldn't
|
36
|
-
// send back any identifying information about errors.
|
37
|
-
if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) {
|
38
|
-
data = undefined;
|
39
|
-
}
|
40
|
-
|
41
|
-
// If the user-agent wants JSON, always respond with JSON
|
42
|
-
// If views are disabled, revert to json
|
43
|
-
if (req.wantsJSON || sails.config.hooks.views === false) {
|
44
|
-
return res.jsonx(data);
|
45
|
-
}
|
46
|
-
|
47
|
-
// If second argument is a string, we take that to mean it refers to a view.
|
48
|
-
// If it was omitted, use an empty object (`{}`)
|
49
|
-
options = (typeof options === 'string') ? { view: options } : options || {};
|
50
|
-
|
51
|
-
// Attempt to prettify data for views, if it's a non-error object
|
52
|
-
var viewData = data;
|
53
|
-
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
|
54
|
-
try {
|
55
|
-
viewData = require('util').inspect(data, {depth: null});
|
56
|
-
}
|
57
|
-
catch(e) {
|
58
|
-
viewData = undefined;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
// If a view was provided in options, serve it.
|
63
|
-
// Otherwise try to guess an appropriate view, or if that doesn't
|
64
|
-
// work, just send JSON.
|
65
|
-
if (options.view) {
|
66
|
-
return res.view(options.view, { data: viewData, title: 'Bad Request' });
|
67
|
-
}
|
68
|
-
|
69
|
-
// If no second argument provided, try to serve the implied view,
|
70
|
-
// but fall back to sending JSON(P) if no view can be inferred.
|
71
|
-
else return res.guessView({ data: viewData, title: 'Bad Request' }, function couldNotGuessView () {
|
72
|
-
return res.jsonx(data);
|
73
|
-
});
|
74
|
-
|
75
|
-
};
|
76
|
-
|
@@ -1,60 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 201 (CREATED) Response
|
3
|
-
*
|
4
|
-
* Usage:
|
5
|
-
* return res.created();
|
6
|
-
* return res.created(data);
|
7
|
-
* return res.created(data, 'auth/login');
|
8
|
-
*
|
9
|
-
* @param {Object} data
|
10
|
-
* @param {String|Object} options
|
11
|
-
* - pass string to render specified view
|
12
|
-
*/
|
13
|
-
|
14
|
-
module.exports = function created (data, options) {
|
15
|
-
|
16
|
-
// Get access to `req`, `res`, & `sails`
|
17
|
-
var req = this.req;
|
18
|
-
var res = this.res;
|
19
|
-
var sails = req._sails;
|
20
|
-
|
21
|
-
sails.log.silly('res.created() :: Sending 201 ("CREATED") response');
|
22
|
-
|
23
|
-
// Set status code
|
24
|
-
res.status(201);
|
25
|
-
|
26
|
-
// If appropriate, serve data as JSON(P)
|
27
|
-
// If views are disabled, revert to json
|
28
|
-
if (req.wantsJSON || sails.config.hooks.views === false) {
|
29
|
-
return res.jsonx(data);
|
30
|
-
}
|
31
|
-
|
32
|
-
// If second argument is a string, we take that to mean it refers to a view.
|
33
|
-
// If it was omitted, use an empty object (`{}`)
|
34
|
-
options = (typeof options === 'string') ? { view: options } : options || {};
|
35
|
-
|
36
|
-
// Attempt to prettify data for views, if it's a non-error object
|
37
|
-
var viewData = data;
|
38
|
-
if (!(viewData instanceof Error) && 'object' == typeof viewData) {
|
39
|
-
try {
|
40
|
-
viewData = require('util').inspect(data, {depth: null});
|
41
|
-
}
|
42
|
-
catch(e) {
|
43
|
-
viewData = undefined;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
// If a view was provided in options, serve it.
|
48
|
-
// Otherwise try to guess an appropriate view, or if that doesn't
|
49
|
-
// work, just send JSON.
|
50
|
-
if (options.view) {
|
51
|
-
return res.view(options.view, { data: viewData, title: 'Created' });
|
52
|
-
}
|
53
|
-
|
54
|
-
// If no second argument provided, try to serve the implied view,
|
55
|
-
// but fall back to sending JSON(P) if no view can be inferred.
|
56
|
-
else return res.guessView({ data: viewData, title: 'Created' }, function couldNotGuessView () {
|
57
|
-
return res.jsonx(data);
|
58
|
-
});
|
59
|
-
|
60
|
-
};
|