update user schema, limit rts to client users
This commit is contained in:
@@ -54,12 +54,16 @@ export async function createUser(
|
||||
|
||||
export async function getUser(userId: string) {
|
||||
if (mongoose.Types.ObjectId.isValid(userId)) {
|
||||
return await userModel.findById(userId);
|
||||
return await userModel
|
||||
.findById(userId)
|
||||
.populate({ path: "orgId", select: "_id pid name" });
|
||||
}
|
||||
|
||||
return await userModel.findOne({
|
||||
$and: [{ pid: userId }],
|
||||
});
|
||||
return await userModel
|
||||
.findOne({
|
||||
$and: [{ pid: userId }],
|
||||
})
|
||||
.populate({ path: "orgId", select: "_id pid name" });
|
||||
}
|
||||
|
||||
export async function getUserByToken(token: string) {
|
||||
|
||||
Reference in New Issue
Block a user