fixing auth check and content type error

This commit is contained in:
talksik
2022-04-01 13:32:51 -04:00
parent 23eeee4228
commit c769f40a15
9 changed files with 174 additions and 125 deletions
+15 -2
View File
@@ -6,8 +6,21 @@ import axios from "axios";
import { collections } from "./database.service";
export class UserService {
static async getUserByGoogleId(userId: string) {
const query = { googleId: userId };
static async getUserById(userId: string) {
const query = { _id: userId };
const res = await collections.users?.findOne(query);
// exists
if (res?._id) {
return res as User;
}
return null;
}
static async getUserByGoogleId(googleUserId: string) {
const query = { googleId: googleUserId };
const res = await collections.users?.findOne(query);