From b32beb0b9c9f19a3444d87aa7369912e54befa90 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 7 Apr 2021 03:03:27 +0200 Subject: :bug: fix lean not working with virtuals --- src/util/User.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/util/User.ts') diff --git a/src/util/User.ts b/src/util/User.ts index 70098bb5..05213642 100644 --- a/src/util/User.ts +++ b/src/util/User.ts @@ -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); } -- cgit 1.5.1