From c118f81b0a7bd49282dafaa2273f49da157da483 Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 1 Oct 2020 10:40:18 +0200 Subject: [PATCH] Fix postgres group error on Sandwiches route --- routes/sandwiches.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/sandwiches.js b/routes/sandwiches.js index 9960013..380cf23 100644 --- a/routes/sandwiches.js +++ b/routes/sandwiches.js @@ -13,9 +13,11 @@ router.get("/", sessionCheck(1), async (req, res) => { sandwiches: await models.Sandwich.findAll({ attributes: ["name", [sequelize.fn("COUNT", sequelize.col("name")), "number"]], include: [{ + attributes: [], model: models.Order, where: {paid: true}, through: { + attributes: [], where: {date: date} }, required: true