0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-17 23:12:39 +00:00

Tidy findTotal

This commit is contained in:
Trevor Buckner
2024-09-03 23:44:43 -04:00
parent 44099c813c
commit 1990064be4

View File

@@ -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)
], ],
}; };