q-koa 13.2.9 → 13.3.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
|
@@ -1974,8 +1974,6 @@ class APP {
|
|
|
1974
1974
|
(ctx.request[`${appName}-user`] &&
|
|
1975
1975
|
((ctx.request[`${appName}-user`].name &&
|
|
1976
1976
|
ctx.request[`${appName}-user`].name === 'admin') ||
|
|
1977
|
-
(ctx.request[`${appName}-user`].mobile &&
|
|
1978
|
-
ctx.request[`${appName}-user`].mobile === '18978909244') ||
|
|
1979
1977
|
ctx.request[`${appName}-user`].is_admin ||
|
|
1980
1978
|
ctx.request[`${appName}-user`].is_dev))
|
|
1981
1979
|
? ['updated_at']
|
|
@@ -149,7 +149,7 @@ exports.initModel = async (ctx) => {
|
|
|
149
149
|
)
|
|
150
150
|
.then((res) => res.data)
|
|
151
151
|
if (code === 200) {
|
|
152
|
-
const findList = Object.keys(productionModel).filter((key) => {
|
|
152
|
+
const findList = Object.keys(productionModel || {}).filter((key) => {
|
|
153
153
|
return (
|
|
154
154
|
!['id', 'created_at', 'createdid', 'updated_at'].includes(key) &&
|
|
155
155
|
!Object.keys(app.attributes[model]).includes(key)
|
package/core/file/utils/index.js
CHANGED
|
@@ -279,7 +279,7 @@ const $in = {
|
|
|
279
279
|
}
|
|
280
280
|
const $between = {
|
|
281
281
|
check: (param) =>
|
|
282
|
-
Array.isArray(param) && param.every((p) => typeof
|
|
282
|
+
Array.isArray(param) && param.every((p) => typeof p === 'string'),
|
|
283
283
|
result: (param, key) => {
|
|
284
284
|
if (param[key].every((i) => getLiteral(i))) {
|
|
285
285
|
return {
|
|
@@ -322,7 +322,7 @@ exports.formatLiteralObj = (target) => {
|
|
|
322
322
|
return target
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
const filterFunction = (target, data) => {
|
|
326
326
|
if (!target) {
|
|
327
327
|
return false
|
|
328
328
|
}
|
|
@@ -333,6 +333,16 @@ exports.filterFunction = (target, data) => {
|
|
|
333
333
|
if (typeof target[key] === 'boolean') {
|
|
334
334
|
return Boolean(data[key]) === target[key]
|
|
335
335
|
}
|
|
336
|
+
if ('$and' in target) {
|
|
337
|
+
return target.$and.every((item) => {
|
|
338
|
+
return filterFunction(item, data)
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
if ('$or' in target) {
|
|
342
|
+
return target.$or.some((item) => {
|
|
343
|
+
return filterFunction(item, data)
|
|
344
|
+
})
|
|
345
|
+
}
|
|
336
346
|
if (Array.isArray(target[key])) {
|
|
337
347
|
return target[key].includes(data[key])
|
|
338
348
|
}
|
|
@@ -386,3 +396,5 @@ exports.filterFunction = (target, data) => {
|
|
|
386
396
|
return data[key] === target[key]
|
|
387
397
|
})
|
|
388
398
|
}
|
|
399
|
+
|
|
400
|
+
exports.filterFunction = filterFunction
|