🐛 fix lean not working with virtuals

This commit is contained in:
Flam3rboy
2021-04-07 03:03:27 +02:00
parent f5180084ff
commit b32beb0b9c
7 changed files with 52 additions and 43 deletions
+3 -5
View File
@@ -1,4 +1,4 @@
import { UserModel } from "fosscord-server-util";
import { toObject, UserModel } from "fosscord-server-util";
import { HTTPError } from "lambert-server";
export const PublicUserProjection = {
@@ -16,9 +16,7 @@ export async function getPublicUser(user_id: string, additional_fields?: any) {
...PublicUserProjection,
...additional_fields,
}
)
.lean()
.exec();
).exec();
if (!user) throw new HTTPError("User not found", 404);
return user;
return toObject(user);
}