Created a new system for the Groups that will persist after having entities
This commit is contained in:
@@ -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});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user