0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +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 brewsQuery = {
$or: [],
published: true,
};
const renderers = [];
if (legacy === 'true') {
brewsQuery.$or.push({ renderer: 'legacy' });
renderers.push('legacy');
}
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;