@webresto/graphql 1.3.2 → 1.3.5
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 +1 -0
- package/lib/eventHelper.ts +1 -0
- package/package.json +1 -1
- package/src/additionalResolvers.js +33 -5
- package/src/additionalResolvers.ts +38 -5
- package/src/graphql.js +35 -22
- package/src/graphql.ts +38 -25
- package/src/resolvers/cart.d.ts +225 -7
- package/src/resolvers/cart.js +21 -7
- package/src/resolvers/cart.ts +23 -8
- package/src/resolvers/checkout.js +9 -7
- package/src/resolvers/checkout.ts +14 -9
- package/test/{_bootstrap.js → bootstrap.js} +6 -7
- package/test/bootstrap.ts +3 -0
- package/test/fixture/.sailsrc +14 -0
- package/test/fixture/api/controllers/.gitkeep +0 -0
- package/test/fixture/api/models/.gitkeep +0 -0
- package/test/fixture/api/services/.gitkeep +0 -0
- package/test/fixture/app-export.js +73 -73
- package/test/fixture/app.js +56 -56
- package/test/fixture/config/adminpanel.js +25 -3
- package/test/fixture/config/bootstrap.js +161 -0
- package/test/fixture/config/connections.js +9 -9
- package/test/fixture/config/env/development.js +10 -10
- package/test/fixture/config/env/production.js +16 -16
- package/test/fixture/config/globals.js +16 -16
- package/test/fixture/config/hookTimeout.js +8 -8
- package/test/fixture/config/http.js +93 -93
- package/test/fixture/config/i18n.js +57 -57
- package/test/fixture/config/log.js +29 -29
- package/test/fixture/config/models.js +8 -8
- package/test/fixture/config/modulemanager.js +22 -22
- package/test/fixture/config/policies.js +51 -51
- package/test/fixture/config/routes.js +49 -49
- package/test/fixture/config/session.js +100 -100
- package/test/fixture/config/sockets.js +141 -141
- package/test/fixture/config/views.js +94 -94
- package/test/fixture/hacks/waterline.js +39 -0
- package/test/fixture/package.json +33 -30
- 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/fixture/views/403.ejs +68 -68
- package/test/fixture/views/404.ejs +68 -68
- package/test/fixture/views/500.ejs +73 -73
- package/test/fixture/views/homepage.ejs +74 -74
- package/test/fixture/views/layout.ejs +91 -91
- package/test/integration/graphql.test.js +11 -0
- package/test/integration/graphql.test.ts +15 -0
- package/test/integration/order.test.js +86 -0
- package/test/integration/order.test.ts +108 -0
- package/test/{unit → integration}/sails_not_crash.test.js +0 -0
- package/test/{unit → integration}/sails_not_crash.test.ts +0 -0
- package/test/unit/first.test.js +1 -1
- package/test/unit/first.test.ts +1 -1
- package/test/fixture/.tmp/localDiskDb/archive.db +0 -1
- package/test/fixture/.tmp/localDiskDb/dish.db +0 -1
- package/test/fixture/.tmp/localDiskDb/dish_images__image_dish.db +0 -1
- package/test/fixture/.tmp/localDiskDb/group.db +0 -1
- package/test/fixture/.tmp/localDiskDb/group_images__image_group.db +0 -1
- package/test/fixture/.tmp/localDiskDb/image.db +0 -1
- package/test/fixture/.tmp/localDiskDb/maintenance.db +0 -1
- package/test/fixture/.tmp/localDiskDb/order.db +0 -1
- package/test/fixture/.tmp/localDiskDb/orderdish.db +0 -1
- package/test/fixture/.tmp/localDiskDb/paymentdocument.db +0 -1
- package/test/fixture/.tmp/localDiskDb/paymentmethod.db +0 -2
- package/test/fixture/.tmp/localDiskDb/place.db +0 -1
- package/test/fixture/.tmp/localDiskDb/settings.db +0 -2
- package/test/fixture/.tmp/localDiskDb/street.db +0 -1
- package/test/fixture/package-lock.json +0 -9805
- package/test.zip +0 -0
package/src/resolvers/cart.ts
CHANGED
@@ -32,7 +32,10 @@ export default {
|
|
32
32
|
);
|
33
33
|
order = await getNewCart(args.orderId);
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
|
+
let fullOrder = await Order.populate(order.id);
|
37
|
+
getEmitter().emit("http-api:before-response-order", fullOrder);
|
38
|
+
return fullOrder
|
36
39
|
},
|
37
40
|
},
|
38
41
|
},
|
@@ -96,7 +99,10 @@ export default {
|
|
96
99
|
args.orderDishId
|
97
100
|
);
|
98
101
|
await Order.countCart(order);
|
99
|
-
|
102
|
+
|
103
|
+
let fullOrder = await Order.populate(order.id);
|
104
|
+
getEmitter().emit("http-api:before-response-order-add-dish", fullOrder);
|
105
|
+
return fullOrder
|
100
106
|
},
|
101
107
|
},
|
102
108
|
orderReplaceDish: {
|
@@ -128,7 +134,9 @@ export default {
|
|
128
134
|
args.orderDishId
|
129
135
|
);
|
130
136
|
await Order.countCart(order);
|
131
|
-
|
137
|
+
let fullOrder = await Order.populate(order.id);
|
138
|
+
getEmitter().emit("http-api:before-response-order-replace-dish", fullOrder);
|
139
|
+
return fullOrder
|
132
140
|
},
|
133
141
|
},
|
134
142
|
orderRemoveDish: {
|
@@ -153,7 +161,9 @@ export default {
|
|
153
161
|
|
154
162
|
await Order.removeDish(order.id, orderDish, args.amount, false);
|
155
163
|
await Order.countCart(order);
|
156
|
-
|
164
|
+
let fullOrder = await Order.populate(order.id);
|
165
|
+
getEmitter().emit("http-api:before-response-order-remove-dish", fullOrder);
|
166
|
+
return fullOrder
|
157
167
|
},
|
158
168
|
},
|
159
169
|
orderSetDishAmount: {
|
@@ -191,7 +201,9 @@ export default {
|
|
191
201
|
|
192
202
|
await Order.setCount(order.id, dish, args.amount);
|
193
203
|
await Order.countCart(order);
|
194
|
-
|
204
|
+
let fullOrder = await Order.populate(order.id);
|
205
|
+
getEmitter().emit("http-api:before-response-order-set-dish-amount", fullOrder);
|
206
|
+
return fullOrder
|
195
207
|
},
|
196
208
|
},
|
197
209
|
orderSetDishComment: {
|
@@ -228,8 +240,9 @@ export default {
|
|
228
240
|
|
229
241
|
await order.setComment(dish, comment);
|
230
242
|
await Order.countCart(order);
|
231
|
-
|
232
|
-
|
243
|
+
let fullOrder = await Order.populate(order.id);
|
244
|
+
getEmitter().emit("http-api:before-response-order-set-dish-comment", fullOrder);
|
245
|
+
return fullOrder },
|
233
246
|
},
|
234
247
|
|
235
248
|
orderUpdate: {
|
@@ -240,7 +253,9 @@ export default {
|
|
240
253
|
if (!order.id) throw "order.id field is required"
|
241
254
|
await Order.update({id: order.id}, {trifleFrom: order.trifleFrom})
|
242
255
|
await Order.populate(order.id);
|
243
|
-
|
256
|
+
let fullOrder = await Order.populate(order.id);
|
257
|
+
getEmitter().emit("http-api:before-response-order-update", fullOrder);
|
258
|
+
return fullOrder
|
244
259
|
},
|
245
260
|
},
|
246
261
|
},
|
@@ -62,11 +62,11 @@ exports.default = {
|
|
62
62
|
order.customData.callback = data.customData.callback;
|
63
63
|
}
|
64
64
|
await Order.update({ id: order.id }, order).fetch();
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
await Order.check(order.id, data.customer, isSelfService, data.address, data.paymentMethodId);
|
66
|
+
order = await Order.findOne(data.orderId);
|
67
|
+
console.log(order.dishes);
|
68
68
|
let message;
|
69
|
-
if (
|
69
|
+
if (order.state === "CHECKOUT") {
|
70
70
|
message = {
|
71
71
|
type: "info",
|
72
72
|
title: "Внимание",
|
@@ -77,16 +77,17 @@ exports.default = {
|
|
77
77
|
}
|
78
78
|
else {
|
79
79
|
if (order.message) {
|
80
|
-
|
80
|
+
message = {
|
81
81
|
type: "error",
|
82
82
|
title: "Внимание",
|
83
83
|
message: order.message
|
84
84
|
? order.message
|
85
85
|
: "Не удалось проверить заказ.",
|
86
|
-
}
|
86
|
+
};
|
87
87
|
}
|
88
88
|
}
|
89
|
-
|
89
|
+
eventHelper.sendMessage(args.orderId, message);
|
90
|
+
return { message: message, order: order };
|
90
91
|
}
|
91
92
|
catch (e) {
|
92
93
|
let message = {
|
@@ -203,6 +204,7 @@ exports.default = {
|
|
203
204
|
// }
|
204
205
|
// }
|
205
206
|
await Order.order(order.id);
|
207
|
+
order = await Order.findOne({ id: data.orderId });
|
206
208
|
const message = {
|
207
209
|
type: "info",
|
208
210
|
title: "Успешно",
|
@@ -42,6 +42,7 @@ export default {
|
|
42
42
|
message: "Корзина уже заказана",
|
43
43
|
});
|
44
44
|
}
|
45
|
+
|
45
46
|
if (data.paymentMethodId) {
|
46
47
|
if (!PaymentMethod.checkAvailable(data.paymentMethodId)) {
|
47
48
|
return eventHelper.sendMessage(args.orderId, {
|
@@ -70,19 +71,20 @@ export default {
|
|
70
71
|
|
71
72
|
await Order.update({ id: order.id }, order).fetch();
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
success = await Order.check(
|
74
|
+
await Order.check(
|
76
75
|
order.id,
|
77
76
|
data.customer,
|
78
77
|
isSelfService,
|
79
78
|
data.address,
|
80
79
|
data.paymentMethodId
|
81
80
|
);
|
82
|
-
|
81
|
+
|
82
|
+
order = await Order.findOne(data.orderId);
|
83
|
+
console.log(order.dishes)
|
84
|
+
|
83
85
|
let message;
|
84
86
|
|
85
|
-
if (
|
87
|
+
if (order.state === "CHECKOUT") {
|
86
88
|
message = {
|
87
89
|
type: "info",
|
88
90
|
title: "Внимание",
|
@@ -90,19 +92,22 @@ export default {
|
|
90
92
|
? order.message
|
91
93
|
: "Заказ готов к оформлению",
|
92
94
|
};
|
95
|
+
|
93
96
|
} else {
|
94
97
|
if (order.message) {
|
95
|
-
|
98
|
+
message = {
|
96
99
|
type: "error",
|
97
100
|
title: "Внимание",
|
98
101
|
message: order.message
|
99
102
|
? order.message
|
100
103
|
: "Не удалось проверить заказ.",
|
101
|
-
}
|
104
|
+
}
|
102
105
|
}
|
103
106
|
}
|
104
107
|
|
105
|
-
|
108
|
+
eventHelper.sendMessage(args.orderId, message);
|
109
|
+
|
110
|
+
return { message: message, order: order };
|
106
111
|
} catch (e) {
|
107
112
|
let message = {
|
108
113
|
type: "error",
|
@@ -218,7 +223,7 @@ export default {
|
|
218
223
|
// }
|
219
224
|
|
220
225
|
await Order.order(order.id);
|
221
|
-
|
226
|
+
order = await Order.findOne({ id: data.orderId })
|
222
227
|
const message = {
|
223
228
|
type: "info",
|
224
229
|
title: "Успешно",
|
@@ -1,15 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
require("mocha");
|
4
|
-
|
4
|
+
require("dotenv").config();
|
5
|
+
var Sails = require("./fixture/node_modules/sails").Sails;
|
6
|
+
process.env.DEV = "TRUE";
|
7
|
+
process.env.LOG_LEVEL = 'silent';
|
5
8
|
before(function (done) {
|
6
|
-
|
9
|
+
require("./fixture/app-export");
|
7
10
|
this.timeout(50000);
|
8
|
-
Sails().lift(
|
11
|
+
Sails().lift({}, function (err, _sails) {
|
9
12
|
if (err)
|
10
13
|
return done(err);
|
11
14
|
global.sails = _sails;
|
12
|
-
// console.log(_sails);
|
13
15
|
return done();
|
14
16
|
});
|
15
17
|
});
|
@@ -18,12 +20,9 @@ after(function (done) {
|
|
18
20
|
return global.sails.lower(function (err) {
|
19
21
|
if (err) {
|
20
22
|
done();
|
21
|
-
return process.exit(2);
|
22
23
|
}
|
23
24
|
done();
|
24
|
-
return process.exit(0);
|
25
25
|
});
|
26
26
|
}
|
27
27
|
done();
|
28
|
-
return process.exit(2);
|
29
28
|
});
|
package/test/bootstrap.ts
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -1,73 +1,73 @@
|
|
1
|
-
/**
|
2
|
-
* app.js
|
3
|
-
*
|
4
|
-
* Use `app.js` to run your app without `sails lift`.
|
5
|
-
* To start the server, run: `node app.js`.
|
6
|
-
*
|
7
|
-
* This is handy in situations where the sails CLI is not relevant or useful.
|
8
|
-
*
|
9
|
-
* For example:
|
10
|
-
* => `node app.js`
|
11
|
-
* => `forever start app.js`
|
12
|
-
* => `node debug app.js`
|
13
|
-
* => `modulus deploy`
|
14
|
-
* => `heroku scale`
|
15
|
-
*
|
16
|
-
*
|
17
|
-
* The same command-line arguments are supported, e.g.:
|
18
|
-
* `node app.js --silent --port=80 --prod`
|
19
|
-
*/
|
20
|
-
|
21
|
-
|
22
|
-
// Ensure we're in the project directory, so cwd-relative paths work as expected
|
23
|
-
// no matter where we actually lift from.
|
24
|
-
// > Note: This is not required in order to lift, but it is a convenient default.
|
25
|
-
process.chdir(__dirname);
|
26
|
-
|
27
|
-
// Attempt to import `sails`.
|
28
|
-
var sails;
|
29
|
-
try {
|
30
|
-
sails = require('sails');
|
31
|
-
} catch (e) {
|
32
|
-
console.error('To run an app using `node app.js`, you usually need to have a version of `sails` installed in the same directory as your app.');
|
33
|
-
console.error('To do that, run `npm install sails`');
|
34
|
-
console.error('');
|
35
|
-
console.error('Alternatively, if you have sails installed globally (i.e. you did `npm install -g sails`), you can use `sails lift`.');
|
36
|
-
console.error('When you run `sails lift`, your app will still use a local `./node_modules/sails` dependency if it exists,');
|
37
|
-
console.error('but if it doesn\'t, the app will run with the global sails instead!');
|
38
|
-
return;
|
39
|
-
}
|
40
|
-
|
41
|
-
// --•
|
42
|
-
// Try to get `rc` dependency (for loading `.sailsrc` files).
|
43
|
-
var rc;
|
44
|
-
try {
|
45
|
-
rc = require('rc');
|
46
|
-
} catch (e0) {
|
47
|
-
try {
|
48
|
-
rc = require('sails/accessible/rc');
|
49
|
-
} catch (e1) {
|
50
|
-
console.error('Could not find dependency: `rc`.');
|
51
|
-
console.error('Your `.sailsrc` file(s) will be ignored.');
|
52
|
-
console.error('To resolve this, run:');
|
53
|
-
console.error('npm install rc --save');
|
54
|
-
rc = function () { return {}; };
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
// function sails() {
|
61
|
-
// return new Promise(function (resolve, reject) {
|
62
|
-
// sails.lift(rc('sails'), (err, _sails) => {
|
63
|
-
// if (err) { return done(err); }
|
64
|
-
// resolve(_sails);
|
65
|
-
// });
|
66
|
-
// })
|
67
|
-
// }
|
68
|
-
|
69
|
-
|
70
|
-
module.exports = {
|
71
|
-
sails: sails,
|
72
|
-
rc: rc('sails')
|
73
|
-
}
|
1
|
+
/**
|
2
|
+
* app.js
|
3
|
+
*
|
4
|
+
* Use `app.js` to run your app without `sails lift`.
|
5
|
+
* To start the server, run: `node app.js`.
|
6
|
+
*
|
7
|
+
* This is handy in situations where the sails CLI is not relevant or useful.
|
8
|
+
*
|
9
|
+
* For example:
|
10
|
+
* => `node app.js`
|
11
|
+
* => `forever start app.js`
|
12
|
+
* => `node debug app.js`
|
13
|
+
* => `modulus deploy`
|
14
|
+
* => `heroku scale`
|
15
|
+
*
|
16
|
+
*
|
17
|
+
* The same command-line arguments are supported, e.g.:
|
18
|
+
* `node app.js --silent --port=80 --prod`
|
19
|
+
*/
|
20
|
+
|
21
|
+
|
22
|
+
// Ensure we're in the project directory, so cwd-relative paths work as expected
|
23
|
+
// no matter where we actually lift from.
|
24
|
+
// > Note: This is not required in order to lift, but it is a convenient default.
|
25
|
+
process.chdir(__dirname);
|
26
|
+
|
27
|
+
// Attempt to import `sails`.
|
28
|
+
var sails;
|
29
|
+
try {
|
30
|
+
sails = require('sails');
|
31
|
+
} catch (e) {
|
32
|
+
console.error('To run an app using `node app.js`, you usually need to have a version of `sails` installed in the same directory as your app.');
|
33
|
+
console.error('To do that, run `npm install sails`');
|
34
|
+
console.error('');
|
35
|
+
console.error('Alternatively, if you have sails installed globally (i.e. you did `npm install -g sails`), you can use `sails lift`.');
|
36
|
+
console.error('When you run `sails lift`, your app will still use a local `./node_modules/sails` dependency if it exists,');
|
37
|
+
console.error('but if it doesn\'t, the app will run with the global sails instead!');
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
|
41
|
+
// --•
|
42
|
+
// Try to get `rc` dependency (for loading `.sailsrc` files).
|
43
|
+
var rc;
|
44
|
+
try {
|
45
|
+
rc = require('rc');
|
46
|
+
} catch (e0) {
|
47
|
+
try {
|
48
|
+
rc = require('sails/accessible/rc');
|
49
|
+
} catch (e1) {
|
50
|
+
console.error('Could not find dependency: `rc`.');
|
51
|
+
console.error('Your `.sailsrc` file(s) will be ignored.');
|
52
|
+
console.error('To resolve this, run:');
|
53
|
+
console.error('npm install rc --save');
|
54
|
+
rc = function () { return {}; };
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
// function sails() {
|
61
|
+
// return new Promise(function (resolve, reject) {
|
62
|
+
// sails.lift(rc('sails'), (err, _sails) => {
|
63
|
+
// if (err) { return done(err); }
|
64
|
+
// resolve(_sails);
|
65
|
+
// });
|
66
|
+
// })
|
67
|
+
// }
|
68
|
+
|
69
|
+
|
70
|
+
module.exports = {
|
71
|
+
sails: sails,
|
72
|
+
rc: rc('sails')
|
73
|
+
}
|
package/test/fixture/app.js
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
/**
|
2
|
-
* app.js
|
3
|
-
*
|
4
|
-
* Use `app.js` to run your app without `sails lift`.
|
5
|
-
* To start the server, run: `node app.js`.
|
6
|
-
*
|
7
|
-
* This is handy in situations where the sails CLI is not relevant or useful,
|
8
|
-
* such as when you deploy to a server, or a PaaS like Heroku.
|
9
|
-
*
|
10
|
-
* For example:
|
11
|
-
* => `node app.js`
|
12
|
-
* => `npm start`
|
13
|
-
* => `forever start app.js`
|
14
|
-
* => `node debug app.js`
|
15
|
-
*
|
16
|
-
* The same command-line arguments and env vars are supported, e.g.:
|
17
|
-
* `NODE_ENV=production node app.js --port=80 --verbose`
|
18
|
-
*
|
19
|
-
* For more information see:
|
20
|
-
* https://sailsjs.com/anatomy/app.js
|
21
|
-
*/
|
22
|
-
|
23
|
-
|
24
|
-
// Ensure we're in the project directory, so cwd-relative paths work as expected
|
25
|
-
// no matter where we actually lift from.
|
26
|
-
// > Note: This is not required in order to lift, but it is a convenient default.
|
27
|
-
process.chdir(__dirname);
|
28
|
-
|
29
|
-
process.env.DEV = "TRUE";
|
30
|
-
|
31
|
-
|
32
|
-
// Attempt to import `sails` dependency, as well as `rc` (for loading `.sailsrc` files).
|
33
|
-
var sails;
|
34
|
-
var rc;
|
35
|
-
try {
|
36
|
-
sails = require('sails');
|
37
|
-
rc = require('sails/accessible/rc');
|
38
|
-
} catch (err) {
|
39
|
-
console.error('Encountered an error when attempting to require(\'sails\'):');
|
40
|
-
console.error(err.stack);
|
41
|
-
console.error('--');
|
42
|
-
console.error('To run an app using `node app.js`, you need to have Sails installed');
|
43
|
-
console.error('locally (`./node_modules/sails`). To do that, just make sure you\'re');
|
44
|
-
console.error('in the same directory as your app and run `npm install`.');
|
45
|
-
console.error();
|
46
|
-
console.error('If Sails is installed globally (i.e. `npm install -g sails`) you can');
|
47
|
-
console.error('also run this app with `sails lift`. Running with `sails lift` will');
|
48
|
-
console.error('not run this file (`app.js`), but it will do exactly the same thing.');
|
49
|
-
console.error('(It even uses your app directory\'s local Sails install, if possible.)');
|
50
|
-
return;
|
51
|
-
}//-•
|
52
|
-
|
53
|
-
console.log(rc('sails'))
|
54
|
-
|
55
|
-
// Start server
|
56
|
-
sails.lift(rc('sails'));
|
1
|
+
/**
|
2
|
+
* app.js
|
3
|
+
*
|
4
|
+
* Use `app.js` to run your app without `sails lift`.
|
5
|
+
* To start the server, run: `node app.js`.
|
6
|
+
*
|
7
|
+
* This is handy in situations where the sails CLI is not relevant or useful,
|
8
|
+
* such as when you deploy to a server, or a PaaS like Heroku.
|
9
|
+
*
|
10
|
+
* For example:
|
11
|
+
* => `node app.js`
|
12
|
+
* => `npm start`
|
13
|
+
* => `forever start app.js`
|
14
|
+
* => `node debug app.js`
|
15
|
+
*
|
16
|
+
* The same command-line arguments and env vars are supported, e.g.:
|
17
|
+
* `NODE_ENV=production node app.js --port=80 --verbose`
|
18
|
+
*
|
19
|
+
* For more information see:
|
20
|
+
* https://sailsjs.com/anatomy/app.js
|
21
|
+
*/
|
22
|
+
|
23
|
+
|
24
|
+
// Ensure we're in the project directory, so cwd-relative paths work as expected
|
25
|
+
// no matter where we actually lift from.
|
26
|
+
// > Note: This is not required in order to lift, but it is a convenient default.
|
27
|
+
process.chdir(__dirname);
|
28
|
+
|
29
|
+
process.env.DEV = "TRUE";
|
30
|
+
process.env.PORT = 42776;
|
31
|
+
|
32
|
+
// Attempt to import `sails` dependency, as well as `rc` (for loading `.sailsrc` files).
|
33
|
+
var sails;
|
34
|
+
var rc;
|
35
|
+
try {
|
36
|
+
sails = require('sails');
|
37
|
+
rc = require('sails/accessible/rc');
|
38
|
+
} catch (err) {
|
39
|
+
console.error('Encountered an error when attempting to require(\'sails\'):');
|
40
|
+
console.error(err.stack);
|
41
|
+
console.error('--');
|
42
|
+
console.error('To run an app using `node app.js`, you need to have Sails installed');
|
43
|
+
console.error('locally (`./node_modules/sails`). To do that, just make sure you\'re');
|
44
|
+
console.error('in the same directory as your app and run `npm install`.');
|
45
|
+
console.error();
|
46
|
+
console.error('If Sails is installed globally (i.e. `npm install -g sails`) you can');
|
47
|
+
console.error('also run this app with `sails lift`. Running with `sails lift` will');
|
48
|
+
console.error('not run this file (`app.js`), but it will do exactly the same thing.');
|
49
|
+
console.error('(It even uses your app directory\'s local Sails install, if possible.)');
|
50
|
+
return;
|
51
|
+
}//-•
|
52
|
+
|
53
|
+
console.log(rc('sails'))
|
54
|
+
|
55
|
+
// Start server
|
56
|
+
sails.lift(rc('sails'));
|
@@ -1,3 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
|
4
|
+
setTimeout(() => {
|
5
|
+
sails.after(["hook:orm:loaded"], () => {
|
6
|
+
Object.keys(sails.models).forEach((modelname) => {
|
7
|
+
let modelName = sails.models[modelname].globalId;
|
8
|
+
sails.config.adminpanel.instances["dev" + modelName] = {
|
9
|
+
title: "dev" + modelName,
|
10
|
+
icon: 'cube',
|
11
|
+
model: modelName,
|
12
|
+
fields: {
|
13
|
+
createdAt: false,
|
14
|
+
updatedAt: false
|
15
|
+
}
|
16
|
+
};
|
17
|
+
});
|
18
|
+
});
|
19
|
+
}, 5000);
|
20
|
+
|
21
|
+
|
22
|
+
module.exports.adminpanel = {
|
23
|
+
instances: {
|
24
|
+
}
|
25
|
+
};
|