summary refs log tree commit diff
path: root/api/src/util/User.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-24 16:35:04 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-24 16:35:04 +0200
commitef4d4a318176c3e572adc17427a8b8c728a618ab (patch)
treed95fedbf18b7b7438613b08b72eb30fa5fca8921 /api/src/util/User.ts
parent:sparkles: typeorm entities (diff)
downloadserver-ef4d4a318176c3e572adc17427a8b8c728a618ab.tar.xz
:construction: api
Diffstat (limited to '')
-rw-r--r--api/src/util/User.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/util/User.ts b/api/src/util/User.ts
index 392c7101..4d9065c4 100644
--- a/api/src/util/User.ts
+++ b/api/src/util/User.ts
@@ -1,16 +1,16 @@
-import { toObject, UserModel, PublicUserProjection } from "@fosscord/util";
+import { toObject, User, PublicUserProjection } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 
 export { PublicUserProjection };
 
 export async function getPublicUser(user_id: string, additional_fields?: any) {
-	const user = await UserModel.findOne(
+	const user = await User.findOneOrFail(
 		{ id: user_id },
 		{
 			...PublicUserProjection,
 			...additional_fields
 		}
-	).exec();
+	);
 	if (!user) throw new HTTPError("User not found", 404);
-	return toObject(user);
+	return user;
 }