change how tags are checked

This commit is contained in:
Víctor Losada Hernández
2026-11-03 00:15:01 +01:00
parent d7e8ae8d14
commit 798f14feba
+11 -9
View File
@@ -33,21 +33,23 @@ const tagConditions = (tagsAnd, tagsOr, tagsNot)=>{
const conditions = {}; const conditions = {};
if (tagsAnd.length > 0) { if (tagsAnd.length > 0) {
conditions.$and = tagsAnd.map((tag)=>({ conditions.tags = {
tags : tag.trim() $all: tagsAnd.map(tag => tag.trim())
})); };
} }
if (tagsOr.length > 0) { if (tagsOr.length > 0) {
conditions.$or = tagsOr.map((tag)=>({ conditions.tags = {
tags : tag.trim() ...conditions.tags,
})); $in: tagsOr.map(tag => tag.trim())
};
} }
if (tagsNot.length > 0) { if (tagsNot.length > 0) {
conditions.$nor = tagsNot.map((tag)=>({ conditions.tags = {
tags : tag.trim() ...conditions.tags,
})); $nin: tagsNot.map(tag => tag.trim())
};
} }
return conditions; return conditions;