mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-10 09:12:39 +00:00
"Simplified brewsQuery construction in buildBrewsQuery function"
This commit is contained in:
@@ -36,15 +36,14 @@ const handleErrorResponse = (res, error, functionName) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const buildBrewsQuery = (legacy, v3) => {
|
const buildBrewsQuery = (legacy, v3) => {
|
||||||
//first off, no need to include renderers, if all are valid
|
const brewsQuery = { published: true };
|
||||||
if (legacy === 'true' && v3 === 'true') return { published: true };
|
if (legacy === 'true' && v3 === 'true') return { published: true };
|
||||||
|
|
||||||
const renderers = [];
|
if (legacy === 'true' && v3 !== 'true') {
|
||||||
if (legacy === 'true') renderers.push('legacy');
|
brewsQuery.renderer = 'legacy';
|
||||||
if (v3 === 'true') renderers.push('V3');
|
} else if (v3 === 'true' && legacy !== 'true') {
|
||||||
|
brewsQuery.renderer = 'V3';
|
||||||
const brewsQuery = { published: true };
|
}
|
||||||
brewsQuery.renderer = { $in: renderers };
|
|
||||||
|
|
||||||
return brewsQuery;
|
return brewsQuery;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user