not-node 4.0.5 → 4.0.9
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/form/index.js +5 -1
- package/src/manifest/route.js +12 -8
package/package.json
CHANGED
package/src/form/index.js
CHANGED
|
@@ -22,7 +22,11 @@ module.exports = class Form {
|
|
|
22
22
|
this.FORM_NAME = FORM_NAME;
|
|
23
23
|
this.FIELDS = FIELDS;
|
|
24
24
|
this.SCHEMA = byFieldsValidators(initFields(FIELDS, 'model'));
|
|
25
|
-
|
|
25
|
+
if (mongoose.modelNames().indexOf(FORM_NAME)===-1){
|
|
26
|
+
this.MODEL = mongoose.model(FORM_NAME, Schema(this.SCHEMA));
|
|
27
|
+
}else{
|
|
28
|
+
this.MODEL = mongoose.connection.model(FORM_NAME);
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
/**
|
package/src/manifest/route.js
CHANGED
|
@@ -162,14 +162,18 @@ class notRoute{
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
async executeRoute(modRoute, actionName, {req, res, next}){
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
try{
|
|
166
|
+
//waiting preparation
|
|
167
|
+
let prepared = await this.executeFunction(modRoute, CONST_BEFORE_ACTION, [req, res, next]);
|
|
168
|
+
//waiting results
|
|
169
|
+
let result = await this.executeFunction(modRoute, actionName, [req, res, next, prepared]);
|
|
170
|
+
//filter result IF actionData.return specified
|
|
171
|
+
this.filterResultByReturnRule(req, result);
|
|
172
|
+
//run after with results, continue without waiting when it finished
|
|
173
|
+
return this.executeFunction(modRoute, CONST_AFTER_ACTION, [req, res, next, result]);
|
|
174
|
+
}catch(e){
|
|
175
|
+
next(e);
|
|
176
|
+
}
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
async executeFunction(obj, name, params) {
|