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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user