@azteam/express 1.2.177 → 1.2.180
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
package/src/AdminController.js
CHANGED
|
@@ -190,14 +190,14 @@ class AdminController extends Controller {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
methodPostImportSheet = async (req, res) => {
|
|
194
194
|
return res.success(true);
|
|
195
195
|
};
|
|
196
196
|
postImportSheet() {
|
|
197
197
|
return {
|
|
198
198
|
disabled: !this.roles.CREATE,
|
|
199
|
-
path: '/',
|
|
200
|
-
method: [adminRoleMiddleware([this.roles.CREATE]), verifyGoogleAppMiddleware(), this.
|
|
199
|
+
path: '/import_sheet',
|
|
200
|
+
method: [adminRoleMiddleware([this.roles.CREATE]), verifyGoogleAppMiddleware(), this.methodPostImportSheet],
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -207,7 +207,7 @@ class AdminController extends Controller {
|
|
|
207
207
|
postExportSheet() {
|
|
208
208
|
return {
|
|
209
209
|
disabled: !this.roles.READ,
|
|
210
|
-
path: '/',
|
|
210
|
+
path: '/export_sheet',
|
|
211
211
|
method: [adminRoleMiddleware([this.roles.READ]), verifyGoogleAppMiddleware(), this.methodPostExportSheet],
|
|
212
212
|
};
|
|
213
213
|
}
|
package/src/Server.js
CHANGED
|
@@ -261,11 +261,10 @@ class Server {
|
|
|
261
261
|
const listPublicRouter = controller.publicRouter();
|
|
262
262
|
|
|
263
263
|
_.map(listPublicRouter, (method) => {
|
|
264
|
-
const {name, type
|
|
265
|
-
|
|
266
|
-
if (!disabled) {
|
|
267
|
-
const router = controller[name]();
|
|
264
|
+
const {name, type} = method;
|
|
268
265
|
|
|
266
|
+
const router = controller[name]();
|
|
267
|
+
if (!router.disabled) {
|
|
269
268
|
router.path = `/${method.path}/${router.path}`;
|
|
270
269
|
router.path = controller.pathName ? `/${controller.pathName}${router.path}` : router.path;
|
|
271
270
|
router.path = controllerVersion.startsWith('v') ? `/${controllerVersion}${router.path}` : router.path;
|
|
@@ -293,11 +292,11 @@ class Server {
|
|
|
293
292
|
throw new ErrorException(NOT_FOUND);
|
|
294
293
|
});
|
|
295
294
|
|
|
296
|
-
app.use((
|
|
297
|
-
const error = errorCatch(
|
|
295
|
+
app.use((err, req, res, next) => {
|
|
296
|
+
const error = errorCatch(err);
|
|
298
297
|
|
|
299
298
|
if (error.errors[0].code === UNKNOWN) {
|
|
300
|
-
console.error(req.originalUrl,
|
|
299
|
+
console.error(req.originalUrl, err);
|
|
301
300
|
}
|
|
302
301
|
|
|
303
302
|
if (this.callbackError) {
|
|
@@ -318,7 +317,7 @@ class Server {
|
|
|
318
317
|
throw error;
|
|
319
318
|
}
|
|
320
319
|
|
|
321
|
-
|
|
320
|
+
const bind = typeof port === 'string' ? `Pipe ${port}` : `Port ${port}`;
|
|
322
321
|
|
|
323
322
|
switch (error.code) {
|
|
324
323
|
case 'EACCES':
|
|
@@ -337,18 +336,15 @@ class Server {
|
|
|
337
336
|
server.listen(port);
|
|
338
337
|
|
|
339
338
|
return server;
|
|
340
|
-
} else {
|
|
341
|
-
throw Error('No controllers in use API');
|
|
342
339
|
}
|
|
343
|
-
|
|
340
|
+
throw Error('No controllers in use API');
|
|
344
341
|
}
|
|
345
342
|
|
|
346
343
|
startSocket(port) {
|
|
347
344
|
if (!_.isEmpty(this.controllers)) {
|
|
348
|
-
|
|
349
|
-
throw Error('No controllers in use SOCKET');
|
|
345
|
+
return this;
|
|
350
346
|
}
|
|
351
|
-
|
|
347
|
+
throw Error('No controllers in use SOCKET');
|
|
352
348
|
}
|
|
353
349
|
|
|
354
350
|
setAlertCallback(callback) {
|
|
@@ -3,10 +3,10 @@ import {ErrorException, USER_NOT_VERIFIED} from '@azteam/error';
|
|
|
3
3
|
|
|
4
4
|
export default function () {
|
|
5
5
|
return async function (req, res, next) {
|
|
6
|
-
if (!req.user.
|
|
6
|
+
if (!req.user.google_api_credential) {
|
|
7
7
|
return next(new ErrorException(USER_NOT_VERIFIED));
|
|
8
8
|
}
|
|
9
|
-
req.user.
|
|
9
|
+
req.user.google_api_credential = JSON.parse(decryptAES(req.user.google_api_credential, process.env.SECRET_KEY));
|
|
10
10
|
|
|
11
11
|
return next();
|
|
12
12
|
};
|