Comparing version 0.0.3 to 0.0.4
@@ -18,3 +18,4 @@ "use strict"; | ||
} | ||
})((yield this.filter([...filter]))).map(function (x) { | ||
}); | ||
(yield this.filter([...filter])).map(function (x) { | ||
return filters.add(x); | ||
@@ -313,3 +314,3 @@ }); | ||
for (let i = 0, l = category.length; i < l; i++) { | ||
category[i] = this.getCategoryId(category[i]); | ||
category[i] = yield this.getCategoryId(category[i]); | ||
} | ||
@@ -320,3 +321,3 @@ condition.category = { $in: category.filter(function (x) { | ||
} else if (category) { | ||
condition.category = this.getCategoryId(category); | ||
condition.category = yield this.getCategoryId(category); | ||
} | ||
@@ -334,27 +335,21 @@ condition.delete = Boolean(del); | ||
} | ||
filter = yield getFilter(filter); | ||
console.log(filter); | ||
filter = yield getFilter.call(this, filter); | ||
let cursor = this.db.find(condition, filter); | ||
console.log(filter); | ||
let ret = []; | ||
if (type & 1) { | ||
cursor.sort(getSort(sort)); | ||
if (from < 0 || from !== parseInt(from) || isNaN(from) || from > 0xFFFFFFFF) { | ||
from = 0; | ||
} | ||
if (length <= 0 || length !== parseInt(length) || isNaN(length) || length > 1000) { | ||
length = 10; | ||
} | ||
cursor.skip(from).limit(length); | ||
ret.push(cursor.toArray().then(function (rs) { | ||
return Promise.all(rs.map(function (r) { | ||
return info.call(_this, r); | ||
})); | ||
})); | ||
} else { | ||
ret.push(null); | ||
cursor.sort(getSort(sort)); | ||
if (from < 0 || from !== parseInt(from) || isNaN(from) || from > 0xFFFFFFFF) { | ||
from = 0; | ||
} | ||
if (type & 2) { | ||
ret.push(cursor.count()); | ||
} else { | ||
ret.push(null); | ||
if (length <= 0 || length !== parseInt(length) || isNaN(length) || length > 1000) { | ||
length = 10; | ||
} | ||
cursor.skip(from).limit(length); | ||
ret.push(cursor.toArray().then(function (rs) { | ||
return Promise.all(rs.map(function (r) { | ||
return info.call(_this, r); | ||
})); | ||
})); | ||
ret.push(cursor.count()); | ||
let [list, num] = yield Promise.all(ret); | ||
@@ -428,3 +423,3 @@ return { list, num }; | ||
} | ||
const keyfield = ["title", "category", "image", "description", "keyword", "content", "order", "review", "hide", "top", "label"]; | ||
const keyfield = ["title", "category", "image", "description", "keyword", "content", "order", "review", "hide", "top", "label", "createDate", "reviewDate", "updateDate", "reviewer", "author"]; | ||
@@ -431,0 +426,0 @@ function getSort(order) { |
{ | ||
"name": "cmk", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Content Management Kernel", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26413
9
1
494