0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 19:42:43 +00:00

change from $or to $in

This commit is contained in:
Víctor Losada Hernández
2024-07-27 10:39:06 +02:00
parent c1dc712542
commit af5bbdc677

View File

@@ -36,17 +36,22 @@ const handleErrorResponse = (res, error, functionName) => {
}; };
const buildBrewsQuery = (legacy, v3) => { const buildBrewsQuery = (legacy, v3) => {
const brewsQuery = { const renderers = [];
$or: [],
published: true,
};
if (legacy === 'true') { if (legacy === 'true') {
brewsQuery.$or.push({ renderer: 'legacy' }); renderers.push('legacy');
} }
if (v3 === 'true') { if (v3 === 'true') {
brewsQuery.$or.push({ renderer: 'V3' }); renderers.push('V3');
}
const brewsQuery = {
published: true,
};
if (renderers.length > 0) {
brewsQuery.renderer = { $in: renderers };
} }
return brewsQuery; return brewsQuery;