/api/groups and /api/invites refactored, fixed some inserts/updates in which I didn't include the id

This commit is contained in:
Carlos Mesquita
2024-09-07 17:54:10 +01:00
parent 56f374bbfe
commit 7fa4edf37d
12 changed files with 128 additions and 135 deletions

View File

@@ -48,7 +48,8 @@ async function patch(req: NextApiRequest, res: NextApiResponse) {
await db.collection("discounts").updateOne(
{ id: id },
{ $set: req.body }
{ $set: { id: id, ...req.body},
{ upsert: true }
);
res.status(200).json({ ok: true });