q-koa 10.0.2 → 10.0.4

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/core/app.js CHANGED
@@ -254,6 +254,9 @@ class APP {
254
254
  ) {
255
255
  this.app[appName].model.log.upsert(errorData)
256
256
  }
257
+ if (process.env.NODE_ENV !== 'production') {
258
+ console.log(err.stack)
259
+ }
257
260
  throw new Error(err.message)
258
261
  })
259
262
 
@@ -442,7 +445,9 @@ class APP {
442
445
  this.app[appName].appConfig &&
443
446
  this.app[appName].appConfig.router
444
447
  ) {
445
- this.app[appName].appConfig.router(router)(this.app[appName])
448
+ try {
449
+ this.app[appName].appConfig.router(router)(this.app[appName])
450
+ } catch (e) {}
446
451
  }
447
452
 
448
453
  if (this.config.defaultRouter) {
@@ -520,7 +525,15 @@ class APP {
520
525
  )
521
526
  const publicExist = fs.existsSync(pluginDir)
522
527
  if (!publicExist) await fsPromise.mkdir(pluginDir)
523
- const pluginDirResult = await fsPromise.readdir(pluginDir)
528
+ const excludesModel = _.get(
529
+ this.app[appName],
530
+ 'appConfig.excludesModel',
531
+ []
532
+ )
533
+ const pluginDirList = await fsPromise.readdir(pluginDir)
534
+ const pluginDirResult = pluginDirList.filter(
535
+ (item) => !excludesModel.includes(item)
536
+ )
524
537
  for (let i = 0; i < pluginDirResult.length; i++) {
525
538
  const folder = pluginDirResult[i]
526
539
  const isFolder = fs
@@ -181,3 +181,13 @@ exports.bulkCreateList = {
181
181
  allowNull: false,
182
182
  defaultValue: [],
183
183
  }
184
+
185
+ exports.alias = {
186
+ type: Sequelize.VIRTUAL,
187
+ comment: 'alias',
188
+ get: function () {
189
+ const name = this.getDataValue('name')
190
+ const model = this.getDataValue('model')
191
+ return name + model
192
+ },
193
+ }
@@ -7,13 +7,16 @@ module.exports = {
7
7
  select: [
8
8
  { key: 'parent_id' },
9
9
  {
10
- key: 'key',
11
- symbol: '$like',
10
+ key: 'model_id',
12
11
  },
13
12
  {
14
13
  key: 'url',
15
14
  symbol: '$like',
16
15
  },
16
+ {
17
+ key: 'key',
18
+ symbol: '$like',
19
+ },
17
20
  ],
18
21
  excludes: [],
19
22
  limit: 40,
@@ -48,6 +48,9 @@ exports.model_id = {
48
48
  defaultValue: 0,
49
49
  sortOrder: 5,
50
50
  mock: () => Random.integer(1, 5),
51
+ extra: {
52
+ key_name: 'alias',
53
+ },
51
54
  }
52
55
 
53
56
  exports.sortOrder = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "10.0.2",
3
+ "version": "10.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {