q-koa 9.0.4 → 9.0.5

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.
@@ -206,8 +206,9 @@ exports.getTable = async (ctx) => {
206
206
 
207
207
  const _result = await app.sequelize.getQueryInterface().describeTable(model)
208
208
 
209
+ const modelAttributes = lodash.cloneDeep(app.attributes[model])
209
210
  const result = lodash.pick(_result, [
210
- ...Object.keys(app.attributes[model]),
211
+ ...Object.keys(modelAttributes),
211
212
  'id',
212
213
  'createdid',
213
214
  'updated_at',
@@ -217,10 +218,10 @@ exports.getTable = async (ctx) => {
217
218
  const obj = {}
218
219
  if (show_virtual) {
219
220
  Array.from(
220
- new Set([...Object.keys(result), ...Object.keys(app.attributes[model])])
221
+ new Set([...Object.keys(result), ...Object.keys(modelAttributes)])
221
222
  ).forEach((attr) => {
222
223
  obj[attr] = lodash.merge(
223
- app.attributes[model][attr],
224
+ modelAttributes[attr],
224
225
  lodash.omitBy(result[attr], lodash.isNull),
225
226
  app.config[_model].comment && app.config[_model].comment
226
227
  ? app.config[_model].comment[attr]
@@ -230,7 +231,7 @@ exports.getTable = async (ctx) => {
230
231
  } else {
231
232
  Object.keys(result).forEach((attr) => {
232
233
  obj[attr] = lodash.merge(
233
- app.attributes[model][attr],
234
+ modelAttributes[attr],
234
235
  lodash.omitBy(result[attr], lodash.isNull),
235
236
  app.config[_model].comment && app.config[_model].comment
236
237
  ? app.config[_model].comment[attr]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "9.0.4",
3
+ "version": "9.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {