adding in proper creation of user

This commit is contained in:
talksik
2022-03-18 17:34:51 -04:00
parent 0a126900b9
commit b9d38a6484
9 changed files with 113 additions and 52 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import { collections } from "./database.service";
export class UserService {
static async getUserById(userId: string) {
const query = { _id: new ObjectId(userId) };
const query = { googleId: userId };
const res = await collections.users?.findOne(query);
@@ -58,7 +58,7 @@ export class UserService {
}
static async createUserIfNotExists(newUser: User) {
const exists = (await collections.users?.findOne({ email: newUser.email }))
const exists = (await collections.users?.findOne({ id: newUser.googleId }))
?._id;
if (!exists) {