@azteam/express 1.2.189 → 1.2.192

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.189",
3
+ "version": "1.2.192",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
@@ -196,9 +196,9 @@ class AdminController extends Controller {
196
196
 
197
197
  postImportSpreadsheet() {
198
198
  return {
199
- disabled: !this.roles.CREATE,
199
+ disabled: !this.roles.IMPORT,
200
200
  path: '/import_spreadsheet',
201
- method: [adminRoleMiddleware([this.roles.CREATE]), verifyGoogleAppMiddleware(), this.methodPostImportSpreadsheet],
201
+ method: [adminRoleMiddleware([this.roles.IMPORT]), verifyGoogleAppMiddleware(), this.methodPostImportSpreadsheet],
202
202
  };
203
203
  }
204
204
 
@@ -208,9 +208,9 @@ class AdminController extends Controller {
208
208
 
209
209
  postExportSpreadsheet() {
210
210
  return {
211
- disabled: !this.roles.READ,
211
+ disabled: !this.roles.EXPORT,
212
212
  path: '/export_spreadsheet',
213
- method: [adminRoleMiddleware([this.roles.READ]), verifyGoogleAppMiddleware(), this.methodPostExportSpreadsheet],
213
+ method: [adminRoleMiddleware([this.roles.EXPORT]), verifyGoogleAppMiddleware(), this.methodPostExportSpreadsheet],
214
214
  };
215
215
  }
216
216
  }
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, allows) {
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, allows);
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, allows);
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 = [], allows = []) {
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 = allows;
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) {
@@ -315,7 +315,7 @@ class Server {
315
315
  }
316
316
 
317
317
  if (this.callbackError) {
318
- this.callbackError(error);
318
+ this.callbackError(error, req.originalUrl);
319
319
  }
320
320
 
321
321
  return res.status(error.status).json({success: false, errors: error.errors});
@@ -5,7 +5,7 @@ function systemLogin(userData = null) {
5
5
  if (userData) {
6
6
  try {
7
7
  user = JSON.parse(userData);
8
- } catch (e) {}
8
+ } catch (err) {}
9
9
  }
10
10
  return user;
11
11
  }
@@ -19,7 +19,7 @@ export default function (cbRefreshToken, cbLoginAPI) {
19
19
  } else {
20
20
  let token = signedCookies.access_token;
21
21
 
22
- if (headers.authorization && signedCookies.api_key != headers.authorization) {
22
+ if (headers.authorization && signedCookies.api_key !== headers.authorization) {
23
23
  token = headers.authorization;
24
24
  }
25
25