mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-17 23:12:39 +00:00
Tidy findTotal
This commit is contained in:
@@ -75,19 +75,15 @@ const findBrews = async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const findTotal = async (req, res) => {
|
const findTotal = async (req, res) => {
|
||||||
const title = req.query.title || '';
|
const title = req.query.title || '';
|
||||||
const author = req.query.author || '';
|
const author = req.query.author || '';
|
||||||
|
|
||||||
const rendererQuery = rendererConditions(req.query.legacy, req.query.v3);
|
|
||||||
const titleQuery = titleConditions(title);
|
|
||||||
const authorQuery = authorConditions(author);
|
|
||||||
|
|
||||||
const combinedQuery = {
|
const combinedQuery = {
|
||||||
$and: [
|
$and: [
|
||||||
{ published: true },
|
{ published: true },
|
||||||
rendererQuery,
|
rendererConditions(req.query.legacy, req.query.v3),
|
||||||
titleQuery,
|
titleConditions(title),
|
||||||
authorQuery,
|
authorConditions(author)
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user