create conversation should work with frontend objectIds

This commit is contained in:
talksik
2022-06-11 09:00:49 -05:00
parent c98e564098
commit 4225a5a029
4 changed files with 78 additions and 13 deletions
+13
View File
@@ -5,6 +5,19 @@ import axios from 'axios';
import { collections } from './database.service';
export class UserService {
static async getUserByObjectId(userId: ObjectId) {
const query = { _id: userId };
const res = await collections.users?.findOne(query);
// exists
if (res?._id) {
return res as User;
}
return null;
}
static async getUserById(userId: string) {
const query = { _id: new ObjectId(userId) };