Created a new system for the Groups that will persist after having entities

This commit is contained in:
Tiago Ribeiro
2024-09-25 16:18:43 +01:00
parent 8c392f8b49
commit dd94228672
18 changed files with 823 additions and 136 deletions

View File

@@ -39,11 +39,12 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
await Promise.all(body.participants.map(async (p) => await updateExpiryDateOnGroup(p, body.admin)));
await db.collection("groups").insertOne({
id: v4(),
name: body.name,
admin: body.admin,
participants: body.participants,
})
res.status(200).json({ok: true});
const id = v4();
await db.collection<Group>("groups").insertOne({
id,
name: body.name,
admin: body.admin,
participants: body.participants,
});
res.status(200).json({ok: true, id});
}