@azteam/express 1.2.189 → 1.2.190
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/Server.js +5 -5
package/package.json
CHANGED
package/src/Server.js
CHANGED
|
@@ -18,12 +18,12 @@ const RES_TYPE = {
|
|
|
18
18
|
DOCS: 'DOCS',
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
function omitItem(item, guard,
|
|
21
|
+
function omitItem(item, guard, allow) {
|
|
22
22
|
let guardFields = guard;
|
|
23
23
|
let itemFields = item;
|
|
24
24
|
|
|
25
25
|
if (_.isArray(guardFields)) {
|
|
26
|
-
guardFields = _.difference(guardFields,
|
|
26
|
+
guardFields = _.difference(guardFields, allow);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (itemFields.toJSON) {
|
|
@@ -31,7 +31,7 @@ function omitItem(item, guard, allows) {
|
|
|
31
31
|
}
|
|
32
32
|
if (_.isObject(itemFields)) {
|
|
33
33
|
if (guardFields === '*') {
|
|
34
|
-
return _.pick(itemFields,
|
|
34
|
+
return _.pick(itemFields, allow);
|
|
35
35
|
}
|
|
36
36
|
return _.omit(itemFields, guardFields);
|
|
37
37
|
}
|
|
@@ -184,7 +184,7 @@ class Server {
|
|
|
184
184
|
throw new ErrorException(code, errors);
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
-
app.response.success = function (data = {}, guard = [],
|
|
187
|
+
app.response.success = function (data = {}, guard = [], allow = []) {
|
|
188
188
|
let guardData = data;
|
|
189
189
|
if (data) {
|
|
190
190
|
let resType = null;
|
|
@@ -198,7 +198,7 @@ class Server {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
let responseGuard = guard;
|
|
201
|
-
const responseAllows =
|
|
201
|
+
const responseAllows = allow;
|
|
202
202
|
if (_.isArray(guard)) {
|
|
203
203
|
responseGuard = [...guard, '__v', '_id', 'deleted_at', 'updated_at', 'created_id', 'modified_id'];
|
|
204
204
|
if (resType === RES_TYPE.ARRAY || resType === RES_TYPE.DOCS) {
|