Solved a bug related to the Batch Create User
This commit is contained in:
@@ -122,7 +122,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
if (!!corporate) {
|
||||
const corporateQ = query(collection(db, "users"), where("email", "==", corporate));
|
||||
const corporateQ = query(collection(db, "users"), where("email", "==", corporate.trim().toLowerCase()));
|
||||
const corporateSnapshot = await getDocs(corporateQ);
|
||||
|
||||
if (!corporateSnapshot.empty) {
|
||||
@@ -146,6 +146,16 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
participants: [...participants, userId],
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const defaultGroup: Group = {
|
||||
admin: corporateUser.id,
|
||||
id: v4(),
|
||||
name: type === "student" ? "Students" : "Teachers",
|
||||
participants: [userId],
|
||||
disableEditing: true,
|
||||
};
|
||||
|
||||
await setDoc(doc(db, "groups", defaultGroup.id), defaultGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user