mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 整合tag与category
This commit is contained in:
1 parent
454afbcb08
commit
7a41fecb0e
15 files changed
+116
-117
No files matched your search
@@ -30,14 +30,7 @@ export class QueryProblemSetAPIHandler extends Handler {
|
||||
}
|
||||
const query: FilterQuery<Pdoc> = {};
|
||||
if ($search) query.$text = { $search };
|
||||
if (tags?.length) {
|
||||
query.$and = tags.map(($eq) => ({
|
||||
$or: [
|
||||
{ category: { $elemMatch: { $eq } } },
|
||||
{ tag: { $elemMatch: { $eq } } },
|
||||
],
|
||||
}));
|
||||
}
|
||||
if (tags?.length) query.$and = tags.map((tag) => ({ tag }));
|
||||
if (owner) query.owner = owner;
|
||||
if (!nonpublic) query.hidden = false;
|
||||
const [raw, count] = await Promise.all([
|
||||
|
||||
Reference in new issue
Block a user