add user route
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import mongoose from "mongoose";
|
||||
import { generateId } from "../utils/id";
|
||||
import { CreateUserInput, UpdateUserInput, userModel } from "./user.schema";
|
||||
|
||||
@@ -14,10 +15,13 @@ export async function createUser(input: CreateUserInput, tenantId: string) {
|
||||
}
|
||||
|
||||
export async function getUser(userId: string) {
|
||||
const user = await userModel.findOne({
|
||||
if (mongoose.Types.ObjectId.isValid(userId)) {
|
||||
return await userModel.findById(userId);
|
||||
}
|
||||
|
||||
return await userModel.findOne({
|
||||
$and: [{ pid: userId }],
|
||||
});
|
||||
return user;
|
||||
}
|
||||
|
||||
export async function getUserByEmail(email: string) {
|
||||
|
||||
Reference in New Issue
Block a user