mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-25 07:36:50 +00:00
change how tags are checked
This commit is contained in:
1 parent
d7e8ae8d14
commit
798f14feba
1 file changed
+11
-9
+11
-9
@@ -33,21 +33,23 @@ const tagConditions = (tagsAnd, tagsOr, tagsNot)=>{
|
||||
const conditions = {};
|
||||
|
||||
if (tagsAnd.length > 0) {
|
||||
conditions.$and = tagsAnd.map((tag)=>({
|
||||
tags : tag.trim()
|
||||
}));
|
||||
conditions.tags = {
|
||||
$all: tagsAnd.map(tag => tag.trim())
|
||||
};
|
||||
}
|
||||
|
||||
if (tagsOr.length > 0) {
|
||||
conditions.$or = tagsOr.map((tag)=>({
|
||||
tags : tag.trim()
|
||||
}));
|
||||
conditions.tags = {
|
||||
...conditions.tags,
|
||||
$in: tagsOr.map(tag => tag.trim())
|
||||
};
|
||||
}
|
||||
|
||||
if (tagsNot.length > 0) {
|
||||
conditions.$nor = tagsNot.map((tag)=>({
|
||||
tags : tag.trim()
|
||||
}));
|
||||
conditions.tags = {
|
||||
...conditions.tags,
|
||||
$nin: tagsNot.map(tag => tag.trim())
|
||||
};
|
||||
}
|
||||
|
||||
return conditions;
|
||||
|
||||
Reference in new issue
Block a user