Started working on the assignments page
This commit is contained in:
@@ -128,8 +128,10 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = uuidv4();
|
||||
|
||||
await db.collection("assignments").insertOne({
|
||||
id: uuidv4(),
|
||||
id,
|
||||
assigner: req.session.user?.id,
|
||||
assignees,
|
||||
results: [],
|
||||
@@ -138,11 +140,10 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
|
||||
...body,
|
||||
});
|
||||
|
||||
res.status(200).json({ok: true});
|
||||
res.status(200).json({ok: true, id});
|
||||
|
||||
for (const assigneeID of assignees) {
|
||||
|
||||
const assignee = await db.collection("users").findOne<User>({ id: assigneeID });
|
||||
const assignee = await db.collection("users").findOne<User>({id: assigneeID});
|
||||
if (!assignee) continue;
|
||||
|
||||
const name = body.name;
|
||||
|
||||
Reference in New Issue
Block a user