populate createdBy on list users
This commit is contained in:
@@ -44,7 +44,10 @@ const userSchema = new mongoose.Schema({
|
||||
{ _id: false }
|
||||
),
|
||||
createdAt: Date,
|
||||
createdBy: mongoose.Types.ObjectId,
|
||||
createdBy: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
lastLogin: Date,
|
||||
dev: Boolean,
|
||||
});
|
||||
|
||||
@@ -138,7 +138,8 @@ export async function listUsers(user: AuthenticatedUser) {
|
||||
.select(
|
||||
"_id pid orgId firstName lastName name email role avatar status createdAt createdBy lastLogin"
|
||||
)
|
||||
.populate({ path: "orgId", select: "_id pid name avatar" });
|
||||
.populate({ path: "orgId", select: "_id pid name avatar" })
|
||||
.populate({ path: "createdBy", select: "_id pid name avatar" });
|
||||
}
|
||||
|
||||
return await userModel
|
||||
@@ -146,7 +147,8 @@ export async function listUsers(user: AuthenticatedUser) {
|
||||
.select(
|
||||
"_id pid orgId firstName lastName name email role avatar status createdAt createdBy lastLogin"
|
||||
)
|
||||
.populate({ path: "orgId", select: "_id pid name avatar" });
|
||||
.populate({ path: "orgId", select: "_id pid name avatar" })
|
||||
.populate({ path: "createdBy", select: "_id pid name avatar" });
|
||||
}
|
||||
|
||||
export async function updateUser(
|
||||
|
||||
Reference in New Issue
Block a user