q-koa 11.8.7 → 11.9.0
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
|
@@ -1158,7 +1158,10 @@ class APP {
|
|
|
1158
1158
|
.filter(
|
|
1159
1159
|
(item) =>
|
|
1160
1160
|
(item.where && !item.hasOwnProperty('required')) ||
|
|
1161
|
-
(item.hasOwnProperty('required') && item.required)
|
|
1161
|
+
(item.hasOwnProperty('required') && item.required) ||
|
|
1162
|
+
(item.hasOwnProperty('where') &&
|
|
1163
|
+
item.hasOwnProperty('required') &&
|
|
1164
|
+
!item.required)
|
|
1162
1165
|
)
|
|
1163
1166
|
.map((item) => {
|
|
1164
1167
|
return {
|
|
@@ -1173,6 +1176,7 @@ class APP {
|
|
|
1173
1176
|
},
|
|
1174
1177
|
}
|
|
1175
1178
|
})
|
|
1179
|
+
|
|
1176
1180
|
const { count, rows } = await app[appName].model[controller][
|
|
1177
1181
|
fn
|
|
1178
1182
|
]({
|
|
@@ -1199,7 +1203,10 @@ class APP {
|
|
|
1199
1203
|
(myInclude[j].where &&
|
|
1200
1204
|
!myInclude[j].hasOwnProperty('required')) ||
|
|
1201
1205
|
(myInclude[j].hasOwnProperty('required') &&
|
|
1202
|
-
myInclude[j].required)
|
|
1206
|
+
myInclude[j].required) ||
|
|
1207
|
+
(myInclude[j].hasOwnProperty('where') &&
|
|
1208
|
+
myInclude[j].hasOwnProperty('required') &&
|
|
1209
|
+
!myInclude[j].required)
|
|
1203
1210
|
) {
|
|
1204
1211
|
continue
|
|
1205
1212
|
}
|
|
@@ -1265,7 +1272,10 @@ class APP {
|
|
|
1265
1272
|
(myInclude[j].where &&
|
|
1266
1273
|
!myInclude[j].hasOwnProperty('required')) ||
|
|
1267
1274
|
(myInclude[j].hasOwnProperty('required') &&
|
|
1268
|
-
myInclude[j].required)
|
|
1275
|
+
myInclude[j].required) ||
|
|
1276
|
+
(myInclude[j].hasOwnProperty('where') &&
|
|
1277
|
+
myInclude[j].hasOwnProperty('required') &&
|
|
1278
|
+
!myInclude[j].required)
|
|
1269
1279
|
) {
|
|
1270
1280
|
continue
|
|
1271
1281
|
}
|
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
|
16
16
|
key: 'type',
|
|
17
17
|
},
|
|
18
18
|
],
|
|
19
|
-
excludes: [],
|
|
19
|
+
excludes: ['administrator'],
|
|
20
20
|
limit: 20,
|
|
21
21
|
defaultOrder: [
|
|
22
22
|
{ sort: 'ascending', type: 'status' },
|
|
@@ -27,5 +27,9 @@ module.exports = {
|
|
|
27
27
|
excludeAuth: [],
|
|
28
28
|
initList: [],
|
|
29
29
|
is_split: false,
|
|
30
|
-
show_virtual:
|
|
30
|
+
show_virtual: true,
|
|
31
|
+
modelUpsert: {
|
|
32
|
+
administrator:
|
|
33
|
+
'(target, getName, user_info) => target.administrator || user_info.name',
|
|
34
|
+
},
|
|
31
35
|
}
|
|
@@ -18,6 +18,9 @@ exports.desc = {
|
|
|
18
18
|
defaultValue: '',
|
|
19
19
|
sortOrder: 2,
|
|
20
20
|
mock: () => Random.csentence(),
|
|
21
|
+
extra: {
|
|
22
|
+
tableWidth: 0,
|
|
23
|
+
},
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
exports.image_list = {
|
|
@@ -67,3 +70,23 @@ exports.important_rate = {
|
|
|
67
70
|
tableWidth: 180,
|
|
68
71
|
},
|
|
69
72
|
}
|
|
73
|
+
|
|
74
|
+
exports.administrator = {
|
|
75
|
+
type: Sequelize.STRING,
|
|
76
|
+
comment: '管理员',
|
|
77
|
+
allowNull: false,
|
|
78
|
+
is_mock: true,
|
|
79
|
+
defaultValue: '',
|
|
80
|
+
sortOrder: 7,
|
|
81
|
+
mock: () => Random.ctitle(),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
exports.from = {
|
|
85
|
+
type: Sequelize.VIRTUAL,
|
|
86
|
+
comment: '来自管理员',
|
|
87
|
+
sortOrder: 8,
|
|
88
|
+
get: function () {
|
|
89
|
+
const administrator = this.getDataValue('administrator')
|
|
90
|
+
return administrator
|
|
91
|
+
},
|
|
92
|
+
}
|