not-node 6.1.6 → 6.1.8
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 +1 -1
- package/src/cli/actions/project.mjs +15 -15
- package/src/identity/identity.js +19 -0
- package/src/identity/index.js +1 -0
- package/src/identity/providers/session.js +23 -1
- package/src/identity/providers/token.js +22 -0
- package/src/init/lib/identity.js +19 -0
- package/src/init/sequence.standart.js +3 -0
- package/src/metas.js +1 -1
- package/.env +0 -12
- package/playground/.env +0 -16
- package/playground/deploy/production.sh +0 -13
- package/playground/deploy/stage.sh +0 -13
- package/playground/nginx/development.conf +0 -55
- package/playground/nginx/production.conf +0 -55
- package/playground/nginx/stage.conf +0 -55
- package/playground/pm2/development.json +0 -46
- package/playground/pm2/production.json +0 -46
- package/playground/pm2/stage.json +0 -46
- package/playground/site/.babelrc +0 -11
- package/playground/site/.eslintignore +0 -4
- package/playground/site/.eslintrc.json +0 -23
- package/playground/site/app/front/build/admin.css +0 -2
- package/playground/site/app/front/build/admin.js +0 -52376
- package/playground/site/app/front/build/client.css +0 -2
- package/playground/site/app/front/build/client.js +0 -52376
- package/playground/site/app/front/build/guest.css +0 -2
- package/playground/site/app/front/build/guest.js +0 -50872
- package/playground/site/app/front/build/root.css +0 -2
- package/playground/site/app/front/build/root.js +0 -59972
- package/playground/site/app/front/build/user.css +0 -2
- package/playground/site/app/front/build/user.js +0 -52374
- package/playground/site/app/front/build.env.js +0 -15
- package/playground/site/app/front/index.!.js +0 -66
- package/playground/site/app/front/index.admin.js +0 -162
- package/playground/site/app/front/index.client.js +0 -162
- package/playground/site/app/front/index.guest.js +0 -162
- package/playground/site/app/front/index.root.js +0 -226
- package/playground/site/app/front/index.user.js +0 -162
- package/playground/site/app/front/rollup.!.js +0 -70
- package/playground/site/app/front/rollup.admin.js +0 -70
- package/playground/site/app/front/rollup.client.js +0 -70
- package/playground/site/app/front/rollup.guest.js +0 -70
- package/playground/site/app/front/rollup.root.js +0 -70
- package/playground/site/app/front/rollup.user.js +0 -70
- package/playground/site/app/front/src/admin/main/index.js +0 -34
- package/playground/site/app/front/src/admin/notNodeModule/index.js +0 -25
- package/playground/site/app/front/src/client/main/index.js +0 -34
- package/playground/site/app/front/src/client/notNodeModule/index.js +0 -25
- package/playground/site/app/front/src/common/index.js +0 -25
- package/playground/site/app/front/src/common/ncInit.js +0 -18
- package/playground/site/app/front/src/common/ws.client.main.js +0 -34
- package/playground/site/app/front/src/guest/main/index.js +0 -45
- package/playground/site/app/front/src/guest/notNodeModule/index.js +0 -25
- package/playground/site/app/front/src/root/main/index.js +0 -34
- package/playground/site/app/front/src/root/notNodeModule/index.js +0 -25
- package/playground/site/app/front/src/user/main/index.js +0 -34
- package/playground/site/app/front/src/user/notNodeModule/index.js +0 -25
- package/playground/site/app/server/app.js +0 -25
- package/playground/site/app/server/config/common.json +0 -92
- package/playground/site/app/server/config/development.json +0 -34
- package/playground/site/app/server/config/production.json +0 -34
- package/playground/site/app/server/config/stage.json +0 -34
- package/playground/site/app/server/index.js +0 -20
- package/playground/site/app/server/modules/notNodeModule/index.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/const.js +0 -1
- package/playground/site/app/server/modules/notNodeModule/src/controllers/admin/index.js +0 -29
- package/playground/site/app/server/modules/notNodeModule/src/controllers/admin/ncNewModel.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/admin/ncTester.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/client/index.js +0 -29
- package/playground/site/app/server/modules/notNodeModule/src/controllers/client/ncNewModel.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/client/ncTester.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/common/ncNewModelCommon.js +0 -103
- package/playground/site/app/server/modules/notNodeModule/src/controllers/common/validators.js +0 -44
- package/playground/site/app/server/modules/notNodeModule/src/controllers/common/ws.client.js +0 -25
- package/playground/site/app/server/modules/notNodeModule/src/controllers/guest/index.js +0 -29
- package/playground/site/app/server/modules/notNodeModule/src/controllers/guest/ncNewModel.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/guest/ncTester.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/root/index.js +0 -29
- package/playground/site/app/server/modules/notNodeModule/src/controllers/root/ncNewModel.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/root/ncTester.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/user/index.js +0 -29
- package/playground/site/app/server/modules/notNodeModule/src/controllers/user/ncNewModel.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/controllers/user/ncTester.js +0 -11
- package/playground/site/app/server/modules/notNodeModule/src/forms/_newModel_data.js +0 -35
- package/playground/site/app/server/modules/notNodeModule/src/forms/_tester_data.js +0 -36
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.create.js +0 -49
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.delete.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.get.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.getRaw.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.listAll.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.listAndCount.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/newModel.update.js +0 -40
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.create.js +0 -52
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.delete.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.get.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.getRaw.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.listAll.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.listAndCount.js +0 -8
- package/playground/site/app/server/modules/notNodeModule/src/forms/tester.update.js +0 -41
- package/playground/site/app/server/modules/notNodeModule/src/logics/newModel.js +0 -229
- package/playground/site/app/server/modules/notNodeModule/src/logics/tester.js +0 -229
- package/playground/site/app/server/modules/notNodeModule/src/models/newModel.js +0 -64
- package/playground/site/app/server/modules/notNodeModule/src/models/tester.js +0 -66
- package/playground/site/app/server/modules/notNodeModule/src/routes/newModel.js +0 -124
- package/playground/site/app/server/modules/notNodeModule/src/routes/newModel.manifest.js +0 -213
- package/playground/site/app/server/modules/notNodeModule/src/routes/newModel.ws.js +0 -29
- package/playground/site/app/server/modules/notNodeModule/src/routes/tester.js +0 -92
- package/playground/site/app/server/modules/notNodeModule/src/routes/tester.manifest.js +0 -215
- package/playground/site/app/server/modules/notNodeModule/src/routes/tester.ws.js +0 -29
- package/playground/site/app/server/routes/index.js +0 -34
- package/playground/site/app/server/routes/site.js +0 -83
- package/playground/site/app/server/views/admin/foot.pug +0 -1
- package/playground/site/app/server/views/admin/head.pug +0 -7
- package/playground/site/app/server/views/admin/menu.pug +0 -2
- package/playground/site/app/server/views/admin.pug +0 -19
- package/playground/site/app/server/views/dashboard.pug +0 -20
- package/playground/site/app/server/views/index.pug +0 -15
- package/playground/site/app/server/views/parts/header.android.pug +0 -6
- package/playground/site/app/server/views/parts/header.ios.pug +0 -5
- package/playground/site/app/server/views/parts/header.pug +0 -18
- package/playground/site/app/server/views/parts/menu.pug +0 -1
- package/playground/site/app/server/views/parts/overview.pug +0 -2
- package/playground/site/app/server/ws/auth.js +0 -41
- package/playground/site/app/server/ws/index.js +0 -84
- package/playground/site/bin/build.sh +0 -8
- package/playground/site/package.json +0 -85
- package/playground/site/project.manifest.json +0 -37
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const { MODULE_NAME } = require("../const");
|
|
2
|
-
const Form = require("not-node").Form;
|
|
3
|
-
const getIP = require("not-node").Auth.getIP;
|
|
4
|
-
|
|
5
|
-
const FIELDS = [
|
|
6
|
-
["targetId", { required: true }, "not-node//objectId"],
|
|
7
|
-
["activeUser", "not-node//requiredObject"],
|
|
8
|
-
["data", `${ModuleName}//_${ModelName}_data`], //sub forms validators should start with underscore
|
|
9
|
-
["ip", "not-node//ip"],
|
|
10
|
-
];
|
|
11
|
-
const FORM_NAME = `${ModuleName}:NewModelUpdateForm`;
|
|
12
|
-
|
|
13
|
-
module.exports = class NewModelUpdateForm extends Form {
|
|
14
|
-
constructor({ app }) {
|
|
15
|
-
super({ FIELDS, FORM_NAME, app });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
extract(req) {
|
|
19
|
-
const instructions = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
legend: "extractFromBody",
|
|
23
|
-
title: "extractFromBody",
|
|
24
|
-
|
|
25
|
-
owner: "fromBody",
|
|
26
|
-
ownerModel: "fromBody",
|
|
27
|
-
};
|
|
28
|
-
const data = this.extractByInstructions(req, instructions);
|
|
29
|
-
if (!req.user.isRoot() && !req.user.isAdmin()) {
|
|
30
|
-
data.owner = req.user._id;
|
|
31
|
-
data.ownerModel = "User";
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
targetId: req.params._id.toString(),
|
|
35
|
-
activeUser: req.user,
|
|
36
|
-
data,
|
|
37
|
-
ip: getIP(req),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const getIP = require("not-node").Auth.getIP;
|
|
2
|
-
const { MODULE_NAME } = require("../const");
|
|
3
|
-
//DB related validation tools
|
|
4
|
-
const Form = require("not-node").Form;
|
|
5
|
-
//form
|
|
6
|
-
const FIELDS = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"title",
|
|
10
|
-
|
|
11
|
-
"age",
|
|
12
|
-
|
|
13
|
-
"qualification",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
const FORM_NAME = `${MODULE_NAME}:TesterCreateForm`;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
**/
|
|
23
|
-
module.exports = class TesterCreateForm extends Form {
|
|
24
|
-
constructor({ app }) {
|
|
25
|
-
super({ FIELDS, FORM_NAME, app });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Extracts data
|
|
30
|
-
* @param {ExpressRequest} req expressjs request object
|
|
31
|
-
* @return {Object} forma data
|
|
32
|
-
**/
|
|
33
|
-
extract(req) {
|
|
34
|
-
const ip = getIP(req);
|
|
35
|
-
const instructions = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
title: "extractFromBody",
|
|
39
|
-
age: "extractFromBody",
|
|
40
|
-
qualification: "extractFromBody",
|
|
41
|
-
|
|
42
|
-
owner: "activeUserId",
|
|
43
|
-
ownerModel: "activeUserModelName",
|
|
44
|
-
};
|
|
45
|
-
const data = this.extractByInstructions(req, instructions);
|
|
46
|
-
return {
|
|
47
|
-
activeUser: req.user,
|
|
48
|
-
ip,
|
|
49
|
-
data,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const { MODULE_NAME } = require("../const");
|
|
2
|
-
const Form = require("not-node").Form;
|
|
3
|
-
const getIP = require("not-node").Auth.getIP;
|
|
4
|
-
|
|
5
|
-
const FIELDS = [
|
|
6
|
-
["targetId", { required: true }, "not-node//objectId"],
|
|
7
|
-
["activeUser", "not-node//requiredObject"],
|
|
8
|
-
["data", `${ModuleName}//_${ModelName}_data`], //sub forms validators should start with underscore
|
|
9
|
-
["ip", "not-node//ip"],
|
|
10
|
-
];
|
|
11
|
-
const FORM_NAME = `${ModuleName}:TesterUpdateForm`;
|
|
12
|
-
|
|
13
|
-
module.exports = class TesterUpdateForm extends Form {
|
|
14
|
-
constructor({ app }) {
|
|
15
|
-
super({ FIELDS, FORM_NAME, app });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
extract(req) {
|
|
19
|
-
const instructions = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
title: "extractFromBody",
|
|
23
|
-
age: "extractFromBody",
|
|
24
|
-
qualification: "extractFromBody",
|
|
25
|
-
|
|
26
|
-
owner: "fromBody",
|
|
27
|
-
ownerModel: "fromBody",
|
|
28
|
-
};
|
|
29
|
-
const data = this.extractByInstructions(req, instructions);
|
|
30
|
-
if (!req.user.isRoot() && !req.user.isAdmin()) {
|
|
31
|
-
data.owner = req.user._id;
|
|
32
|
-
data.ownerModel = "User";
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
targetId: req.params._id.toString(),
|
|
36
|
-
activeUser: req.user,
|
|
37
|
-
data,
|
|
38
|
-
ip: getIP(req),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
const MODEL_NAME = "NewModel";
|
|
2
|
-
|
|
3
|
-
const { MODULE_NAME } = require("../const.js");
|
|
4
|
-
const notNode = require("not-node");
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
Log,
|
|
8
|
-
LogAction,
|
|
9
|
-
say,
|
|
10
|
-
phrase,
|
|
11
|
-
config,
|
|
12
|
-
getModel,
|
|
13
|
-
getModelSchema,
|
|
14
|
-
getLogic,
|
|
15
|
-
getModelUser,
|
|
16
|
-
} = notNode.Bootstrap.notBootstrapLogic({
|
|
17
|
-
target: module,
|
|
18
|
-
MODEL_NAME,
|
|
19
|
-
MODULE_NAME,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const populateBuilders = {};
|
|
23
|
-
|
|
24
|
-
const NewModelGenericLogic = notNode.Generic.GenericLogic({
|
|
25
|
-
MODEL_NAME,
|
|
26
|
-
MODULE_NAME,
|
|
27
|
-
Log,
|
|
28
|
-
LogAction,
|
|
29
|
-
say,
|
|
30
|
-
phrase,
|
|
31
|
-
config,
|
|
32
|
-
getModel,
|
|
33
|
-
getModelSchema,
|
|
34
|
-
getLogic,
|
|
35
|
-
getModelUser,
|
|
36
|
-
populateBuilders,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
module.exports.thisLogicName = MODEL_NAME;
|
|
40
|
-
|
|
41
|
-
class NewModelLogic extends NewModelGenericLogic {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
static async create({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
45
|
-
const action = "create";
|
|
46
|
-
Log.debug(
|
|
47
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
48
|
-
targetId,
|
|
49
|
-
ip,
|
|
50
|
-
root
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const results = await getModel().create(
|
|
54
|
-
targetId,
|
|
55
|
-
activeUser._id,
|
|
56
|
-
data
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
LogAction({
|
|
60
|
-
action,
|
|
61
|
-
by: activeUser._id,
|
|
62
|
-
role: activeUser.role,
|
|
63
|
-
ip,
|
|
64
|
-
root,
|
|
65
|
-
shouldOwn,
|
|
66
|
-
});
|
|
67
|
-
return results;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static async delete({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
71
|
-
const action = "delete";
|
|
72
|
-
Log.debug(
|
|
73
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
74
|
-
targetId,
|
|
75
|
-
ip,
|
|
76
|
-
root
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const results = await getModel().delete(
|
|
80
|
-
targetId,
|
|
81
|
-
activeUser._id,
|
|
82
|
-
data
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
LogAction({
|
|
86
|
-
action,
|
|
87
|
-
by: activeUser._id,
|
|
88
|
-
role: activeUser.role,
|
|
89
|
-
ip,
|
|
90
|
-
root,
|
|
91
|
-
shouldOwn,
|
|
92
|
-
});
|
|
93
|
-
return results;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
static async get({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
97
|
-
const action = "get";
|
|
98
|
-
Log.debug(
|
|
99
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
100
|
-
targetId,
|
|
101
|
-
ip,
|
|
102
|
-
root
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const results = await getModel().get(
|
|
106
|
-
targetId,
|
|
107
|
-
activeUser._id,
|
|
108
|
-
data
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
LogAction({
|
|
112
|
-
action,
|
|
113
|
-
by: activeUser._id,
|
|
114
|
-
role: activeUser.role,
|
|
115
|
-
ip,
|
|
116
|
-
root,
|
|
117
|
-
shouldOwn,
|
|
118
|
-
});
|
|
119
|
-
return results;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static async getRaw({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
123
|
-
const action = "getRaw";
|
|
124
|
-
Log.debug(
|
|
125
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
126
|
-
targetId,
|
|
127
|
-
ip,
|
|
128
|
-
root
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const results = await getModel().getRaw(
|
|
132
|
-
targetId,
|
|
133
|
-
activeUser._id,
|
|
134
|
-
data
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
LogAction({
|
|
138
|
-
action,
|
|
139
|
-
by: activeUser._id,
|
|
140
|
-
role: activeUser.role,
|
|
141
|
-
ip,
|
|
142
|
-
root,
|
|
143
|
-
shouldOwn,
|
|
144
|
-
});
|
|
145
|
-
return results;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
static async listAll({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
149
|
-
const action = "listAll";
|
|
150
|
-
Log.debug(
|
|
151
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
152
|
-
targetId,
|
|
153
|
-
ip,
|
|
154
|
-
root
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
const results = await getModel().listAll(
|
|
158
|
-
targetId,
|
|
159
|
-
activeUser._id,
|
|
160
|
-
data
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
LogAction({
|
|
164
|
-
action,
|
|
165
|
-
by: activeUser._id,
|
|
166
|
-
role: activeUser.role,
|
|
167
|
-
ip,
|
|
168
|
-
root,
|
|
169
|
-
shouldOwn,
|
|
170
|
-
});
|
|
171
|
-
return results;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
static async listAndCount({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
175
|
-
const action = "listAndCount";
|
|
176
|
-
Log.debug(
|
|
177
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
178
|
-
targetId,
|
|
179
|
-
ip,
|
|
180
|
-
root
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
const results = await getModel().listAndCount(
|
|
184
|
-
targetId,
|
|
185
|
-
activeUser._id,
|
|
186
|
-
data
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
LogAction({
|
|
190
|
-
action,
|
|
191
|
-
by: activeUser._id,
|
|
192
|
-
role: activeUser.role,
|
|
193
|
-
ip,
|
|
194
|
-
root,
|
|
195
|
-
shouldOwn,
|
|
196
|
-
});
|
|
197
|
-
return results;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
static async update({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
201
|
-
const action = "update";
|
|
202
|
-
Log.debug(
|
|
203
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
204
|
-
targetId,
|
|
205
|
-
ip,
|
|
206
|
-
root
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
const results = await getModel().update(
|
|
210
|
-
targetId,
|
|
211
|
-
activeUser._id,
|
|
212
|
-
data
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
LogAction({
|
|
216
|
-
action,
|
|
217
|
-
by: activeUser._id,
|
|
218
|
-
role: activeUser.role,
|
|
219
|
-
ip,
|
|
220
|
-
root,
|
|
221
|
-
shouldOwn,
|
|
222
|
-
});
|
|
223
|
-
return results;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
module.exports[MODEL_NAME] = NewModelLogic;
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
const MODEL_NAME = "Tester";
|
|
2
|
-
|
|
3
|
-
const { MODULE_NAME } = require("../const.js");
|
|
4
|
-
const notNode = require("not-node");
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
Log,
|
|
8
|
-
LogAction,
|
|
9
|
-
say,
|
|
10
|
-
phrase,
|
|
11
|
-
config,
|
|
12
|
-
getModel,
|
|
13
|
-
getModelSchema,
|
|
14
|
-
getLogic,
|
|
15
|
-
getModelUser,
|
|
16
|
-
} = notNode.Bootstrap.notBootstrapLogic({
|
|
17
|
-
target: module,
|
|
18
|
-
MODEL_NAME,
|
|
19
|
-
MODULE_NAME,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const populateBuilders = {};
|
|
23
|
-
|
|
24
|
-
const TesterGenericLogic = notNode.Generic.GenericLogic({
|
|
25
|
-
MODEL_NAME,
|
|
26
|
-
MODULE_NAME,
|
|
27
|
-
Log,
|
|
28
|
-
LogAction,
|
|
29
|
-
say,
|
|
30
|
-
phrase,
|
|
31
|
-
config,
|
|
32
|
-
getModel,
|
|
33
|
-
getModelSchema,
|
|
34
|
-
getLogic,
|
|
35
|
-
getModelUser,
|
|
36
|
-
populateBuilders,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
module.exports.thisLogicName = MODEL_NAME;
|
|
40
|
-
|
|
41
|
-
class TesterLogic extends TesterGenericLogic {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
static async create({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
45
|
-
const action = "create";
|
|
46
|
-
Log.debug(
|
|
47
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
48
|
-
targetId,
|
|
49
|
-
ip,
|
|
50
|
-
root
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const results = await getModel().create(
|
|
54
|
-
targetId,
|
|
55
|
-
activeUser._id,
|
|
56
|
-
data
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
LogAction({
|
|
60
|
-
action,
|
|
61
|
-
by: activeUser._id,
|
|
62
|
-
role: activeUser.role,
|
|
63
|
-
ip,
|
|
64
|
-
root,
|
|
65
|
-
shouldOwn,
|
|
66
|
-
});
|
|
67
|
-
return results;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static async delete({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
71
|
-
const action = "delete";
|
|
72
|
-
Log.debug(
|
|
73
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
74
|
-
targetId,
|
|
75
|
-
ip,
|
|
76
|
-
root
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const results = await getModel().delete(
|
|
80
|
-
targetId,
|
|
81
|
-
activeUser._id,
|
|
82
|
-
data
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
LogAction({
|
|
86
|
-
action,
|
|
87
|
-
by: activeUser._id,
|
|
88
|
-
role: activeUser.role,
|
|
89
|
-
ip,
|
|
90
|
-
root,
|
|
91
|
-
shouldOwn,
|
|
92
|
-
});
|
|
93
|
-
return results;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
static async get({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
97
|
-
const action = "get";
|
|
98
|
-
Log.debug(
|
|
99
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
100
|
-
targetId,
|
|
101
|
-
ip,
|
|
102
|
-
root
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const results = await getModel().get(
|
|
106
|
-
targetId,
|
|
107
|
-
activeUser._id,
|
|
108
|
-
data
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
LogAction({
|
|
112
|
-
action,
|
|
113
|
-
by: activeUser._id,
|
|
114
|
-
role: activeUser.role,
|
|
115
|
-
ip,
|
|
116
|
-
root,
|
|
117
|
-
shouldOwn,
|
|
118
|
-
});
|
|
119
|
-
return results;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static async getRaw({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
123
|
-
const action = "getRaw";
|
|
124
|
-
Log.debug(
|
|
125
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
126
|
-
targetId,
|
|
127
|
-
ip,
|
|
128
|
-
root
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const results = await getModel().getRaw(
|
|
132
|
-
targetId,
|
|
133
|
-
activeUser._id,
|
|
134
|
-
data
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
LogAction({
|
|
138
|
-
action,
|
|
139
|
-
by: activeUser._id,
|
|
140
|
-
role: activeUser.role,
|
|
141
|
-
ip,
|
|
142
|
-
root,
|
|
143
|
-
shouldOwn,
|
|
144
|
-
});
|
|
145
|
-
return results;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
static async listAll({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
149
|
-
const action = "listAll";
|
|
150
|
-
Log.debug(
|
|
151
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
152
|
-
targetId,
|
|
153
|
-
ip,
|
|
154
|
-
root
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
const results = await getModel().listAll(
|
|
158
|
-
targetId,
|
|
159
|
-
activeUser._id,
|
|
160
|
-
data
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
LogAction({
|
|
164
|
-
action,
|
|
165
|
-
by: activeUser._id,
|
|
166
|
-
role: activeUser.role,
|
|
167
|
-
ip,
|
|
168
|
-
root,
|
|
169
|
-
shouldOwn,
|
|
170
|
-
});
|
|
171
|
-
return results;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
static async listAndCount({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
175
|
-
const action = "listAndCount";
|
|
176
|
-
Log.debug(
|
|
177
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
178
|
-
targetId,
|
|
179
|
-
ip,
|
|
180
|
-
root
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
const results = await getModel().listAndCount(
|
|
184
|
-
targetId,
|
|
185
|
-
activeUser._id,
|
|
186
|
-
data
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
LogAction({
|
|
190
|
-
action,
|
|
191
|
-
by: activeUser._id,
|
|
192
|
-
role: activeUser.role,
|
|
193
|
-
ip,
|
|
194
|
-
root,
|
|
195
|
-
shouldOwn,
|
|
196
|
-
});
|
|
197
|
-
return results;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
static async update({ targetId, activeUser, ip, root, shouldOwn, data }) {
|
|
201
|
-
const action = "update";
|
|
202
|
-
Log.debug(
|
|
203
|
-
`${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
|
|
204
|
-
targetId,
|
|
205
|
-
ip,
|
|
206
|
-
root
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
const results = await getModel().update(
|
|
210
|
-
targetId,
|
|
211
|
-
activeUser._id,
|
|
212
|
-
data
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
LogAction({
|
|
216
|
-
action,
|
|
217
|
-
by: activeUser._id,
|
|
218
|
-
role: activeUser.role,
|
|
219
|
-
ip,
|
|
220
|
-
root,
|
|
221
|
-
shouldOwn,
|
|
222
|
-
});
|
|
223
|
-
return results;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
module.exports[MODEL_NAME] = TesterLogic;
|