@webresto/graphql 1.3.5 → 1.3.6
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/lib/eventHelper.js +0 -1
- package/lib/eventHelper.ts +0 -1
- package/lib/graphqlHelper.js +0 -5
- package/lib/graphqlHelper.ts +0 -7
- package/package.json +1 -1
- package/src/additionalResolvers.d.ts +6 -0
- package/src/resolvers/checkout.d.ts +1 -1
- package/src/resolvers/checkout.js +0 -1
- package/src/resolvers/checkout.ts +0 -1
- package/test/integration/graphql.test.js +0 -1
- package/test/integration/graphql.test.ts +0 -1
- package/test/integration/order.test.js +0 -4
- package/test/integration/order.test.ts +3 -4
- package/todo.md +1 -1
- package/restApi.http +0 -11
package/lib/eventHelper.js
CHANGED
package/lib/eventHelper.ts
CHANGED
package/lib/graphqlHelper.js
CHANGED
@@ -223,17 +223,12 @@ function createType(model) {
|
|
223
223
|
scalarType = scalarTypes[relationModel.attributes[relationModel.primaryKey].type];
|
224
224
|
const name = sails.models[attributes[prop].model.toLowerCase()].globalId;
|
225
225
|
type += ` ${prop}: ${name}\n`;
|
226
|
-
// todelete
|
227
|
-
type += ` ${prop}Id: ${scalarType}\n`;
|
228
226
|
}
|
229
227
|
// COLLECTION SCHEMA GENERATION
|
230
228
|
if (attributes[prop].collection) {
|
231
229
|
scalarType = scalarTypes[attributes[sails.models[attributes[prop].collection.toLowerCase()].primaryKey].type.toLowerCase()];
|
232
230
|
const name = sails.models[attributes[prop].collection.toLowerCase()].globalId;
|
233
|
-
console.log(1, scalarType);
|
234
231
|
type += ` ${prop}: [${name}]\n`;
|
235
|
-
// todelete
|
236
|
-
type += ` ${prop}Ids: ${scalarType}\n`;
|
237
232
|
}
|
238
233
|
}
|
239
234
|
if (customFields[modelName]) {
|
package/lib/graphqlHelper.ts
CHANGED
@@ -228,20 +228,13 @@ function createType(model) {
|
|
228
228
|
scalarType = scalarTypes[relationModel.attributes[relationModel.primaryKey].type]
|
229
229
|
const name = sails.models[attributes[prop].model.toLowerCase()].globalId;
|
230
230
|
type += ` ${prop}: ${name}\n`;
|
231
|
-
|
232
|
-
// todelete
|
233
|
-
type += ` ${prop}Id: ${scalarType}\n`;
|
234
231
|
}
|
235
232
|
|
236
233
|
// COLLECTION SCHEMA GENERATION
|
237
234
|
if (attributes[prop].collection) {
|
238
235
|
scalarType = scalarTypes[attributes[sails.models[attributes[prop].collection.toLowerCase()].primaryKey].type.toLowerCase()]
|
239
236
|
const name = sails.models[attributes[prop].collection.toLowerCase()].globalId;
|
240
|
-
console.log(1,scalarType)
|
241
237
|
type += ` ${prop}: [${name}]\n`;
|
242
|
-
|
243
|
-
// todelete
|
244
|
-
type += ` ${prop}Ids: ${scalarType}\n`;
|
245
238
|
}
|
246
239
|
}
|
247
240
|
if (customFields[modelName]) {
|
package/package.json
CHANGED
@@ -16,4 +16,10 @@ export declare const additionalResolver: {
|
|
16
16
|
Group: {
|
17
17
|
parentGroup: (parent: any, args: any, context: any, info: any) => Promise<any>;
|
18
18
|
};
|
19
|
+
Order: {
|
20
|
+
dishes: (parent: any, args: any, context: any, info: any) => Promise<any>;
|
21
|
+
};
|
22
|
+
OrderDish: {
|
23
|
+
dish: (parent: any, args: any, context: any, info: any) => Promise<any>;
|
24
|
+
};
|
19
25
|
};
|
@@ -64,7 +64,6 @@ exports.default = {
|
|
64
64
|
await Order.update({ id: order.id }, order).fetch();
|
65
65
|
await Order.check(order.id, data.customer, isSelfService, data.address, data.paymentMethodId);
|
66
66
|
order = await Order.findOne(data.orderId);
|
67
|
-
console.log(order.dishes);
|
68
67
|
let message;
|
69
68
|
if (order.state === "CHECKOUT") {
|
70
69
|
message = {
|
@@ -2,7 +2,6 @@ const expect = require("chai").expect;
|
|
2
2
|
describe('GraphQl', function () {
|
3
3
|
it('Added fields exist in schema', async () => {
|
4
4
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
5
|
-
console.log(graphql);
|
6
5
|
const result = await graphql.getServer().executeOperation({
|
7
6
|
query: '{dish { id } \n group { id }}'
|
8
7
|
});
|
@@ -4,7 +4,6 @@ describe('GraphQl', function () {
|
|
4
4
|
it('Added fields exist in schema', async () => {
|
5
5
|
|
6
6
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
7
|
-
console.log(graphql)
|
8
7
|
const result = await graphql.getServer().executeOperation({
|
9
8
|
query: '{dish { id } \n group { id }}'
|
10
9
|
});
|
@@ -2,7 +2,6 @@ const expect = require("chai").expect;
|
|
2
2
|
describe('Send order to restarant', function () {
|
3
3
|
it('Create new', async () => {
|
4
4
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
5
|
-
console.log(graphql);
|
6
5
|
const result = await graphql.getServer().executeOperation({
|
7
6
|
query: `
|
8
7
|
{order(orderId:"test-cart"){
|
@@ -14,7 +13,6 @@ describe('Send order to restarant', function () {
|
|
14
13
|
});
|
15
14
|
it('orderAddDish', async () => {
|
16
15
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
17
|
-
console.log(graphql);
|
18
16
|
const result = await graphql.getServer().executeOperation({
|
19
17
|
query: `
|
20
18
|
mutation{orderAddDish(dishId: "df19cbbc-c026-595e-9296-1c8a378da6b3", orderId:"test-cart", amount: 1){
|
@@ -34,7 +32,6 @@ describe('Send order to restarant', function () {
|
|
34
32
|
});
|
35
33
|
it('checkOrder', async () => {
|
36
34
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
37
|
-
console.log(graphql);
|
38
35
|
const result = await graphql.getServer().executeOperation({
|
39
36
|
query: `
|
40
37
|
mutation{checkOrder(orderId:"test-cart", paymentMethodId: "", address: {city: "town", street: "test", home: "123"}, customer: {phone: {code: "+1", number: "0000000000"}, name: "Piter Parker"}) {
|
@@ -59,7 +56,6 @@ describe('Send order to restarant', function () {
|
|
59
56
|
});
|
60
57
|
it('sendOrder', async () => {
|
61
58
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
62
|
-
console.log(graphql);
|
63
59
|
const result = await graphql.getServer().executeOperation({
|
64
60
|
query: `
|
65
61
|
mutation{sendOrder(orderId:"test-cart") {
|
@@ -4,7 +4,6 @@ describe('Send order to restarant', function () {
|
|
4
4
|
it('Create new', async () => {
|
5
5
|
|
6
6
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
7
|
-
console.log(graphql)
|
8
7
|
const result = await graphql.getServer().executeOperation({
|
9
8
|
query: `
|
10
9
|
{order(orderId:"test-cart"){
|
@@ -22,7 +21,7 @@ describe('Send order to restarant', function () {
|
|
22
21
|
it('orderAddDish', async () => {
|
23
22
|
|
24
23
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
25
|
-
|
24
|
+
|
26
25
|
const result = await graphql.getServer().executeOperation({
|
27
26
|
query: `
|
28
27
|
mutation{orderAddDish(dishId: "df19cbbc-c026-595e-9296-1c8a378da6b3", orderId:"test-cart", amount: 1){
|
@@ -45,7 +44,7 @@ describe('Send order to restarant', function () {
|
|
45
44
|
it('checkOrder', async () => {
|
46
45
|
|
47
46
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
48
|
-
|
47
|
+
|
49
48
|
const result = await graphql.getServer().executeOperation({
|
50
49
|
query: `
|
51
50
|
mutation{checkOrder(orderId:"test-cart", paymentMethodId: "", address: {city: "town", street: "test", home: "123"}, customer: {phone: {code: "+1", number: "0000000000"}, name: "Piter Parker"}) {
|
@@ -74,7 +73,7 @@ describe('Send order to restarant', function () {
|
|
74
73
|
it('sendOrder', async () => {
|
75
74
|
|
76
75
|
const graphql = require('./../fixture/node_modules/@webresto/graphql/src/graphql').default;
|
77
|
-
|
76
|
+
|
78
77
|
const result = await graphql.getServer().executeOperation({
|
79
78
|
query: `
|
80
79
|
mutation{sendOrder(orderId:"test-cart") {
|
package/todo.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1. Add support for multi websoketServer (several tests placed in lib dirrectory)
|
1
|
+
1. Add support for multi websoketServer (several tests placed in lib dirrectory)
|