Archived
1
0
Fork 0

Fix postgres group error on Sandwiches route

This commit is contained in:
Ethanell 2020-10-01 10:40:18 +02:00
parent 085ae08b74
commit c118f81b0a

View file

@ -13,9 +13,11 @@ router.get("/", sessionCheck(1), async (req, res) => {
sandwiches: await models.Sandwich.findAll({ sandwiches: await models.Sandwich.findAll({
attributes: ["name", [sequelize.fn("COUNT", sequelize.col("name")), "number"]], attributes: ["name", [sequelize.fn("COUNT", sequelize.col("name")), "number"]],
include: [{ include: [{
attributes: [],
model: models.Order, model: models.Order,
where: {paid: true}, where: {paid: true},
through: { through: {
attributes: [],
where: {date: date} where: {date: date}
}, },
required: true required: true