/api/groups and /api/invites refactored, fixed some inserts/updates in which I didn't include the id
This commit is contained in:
@@ -108,12 +108,14 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
{ id: codeRef.id },
|
||||
{
|
||||
$set: {
|
||||
id: codeRef.id,
|
||||
...codeInformation,
|
||||
email: email.trim().toLowerCase(),
|
||||
name: name.trim(),
|
||||
...(passport_id ? { passport_id: passport_id.trim() } : {}),
|
||||
}
|
||||
}
|
||||
},
|
||||
{ upsert: true }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,7 +127,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
// upsert: true -> if it doesnt exist insert
|
||||
await db.collection("codes").updateOne(
|
||||
{ id: code },
|
||||
{ $set: codeInformation },
|
||||
{ $set: { id: code, ...codeInformation} },
|
||||
{ upsert: true }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user