Skip to content
Snippets Groups Projects
Unverified Commit 3c77ae7b authored by syuilo's avatar syuilo
Browse files

Improve log api

parent 60c30ece
No related merge requests found
......@@ -34,10 +34,26 @@ export default define(meta, async (ps) => {
if (ps.level) query.level = ps.level;
if (ps.domain) {
let i = 0;
for (const d of ps.domain.split('.')) {
query[`domain.${i}`] = d;
i++;
for (const d of ps.domain.split(' ')) {
const qs: any[] = [];
let i = 0;
for (const sd of (d.startsWith('-') ? d.substr(1) : d).split('.')) {
qs.push({
[`domain.${i}`]: d.startsWith('-') ? { $ne: sd } : sd
});
i++;
}
if (d.startsWith('-')) {
if (query['$and'] == null) query['$and'] = [];
query['$and'].push({
$and: qs
});
} else {
if (query['$or'] == null) query['$or'] = [];
query['$or'].push({
$and: qs
});
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment