fixing auth check and content type error
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user