summary refs log tree commit diff
path: root/api/src/routes/users
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-05 19:52:42 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-05 19:52:42 +0200
commitce6363909015eae9ff19389f0b929ab5e56a096f (patch)
tree4b09029da3a3bc9219391075282b68a291833ba0 /api/src/routes/users
parent:art: reformatted (diff)
downloadserver-ce6363909015eae9ff19389f0b929ab5e56a096f.tar.xz
:bug: fix user projection
Diffstat (limited to 'api/src/routes/users')
-rw-r--r--api/src/routes/users/@me/delete.ts2
-rw-r--r--api/src/routes/users/@me/disable.ts2
-rw-r--r--api/src/routes/users/@me/relationships.ts6
3 files changed, 7 insertions, 3 deletions
diff --git a/api/src/routes/users/@me/delete.ts b/api/src/routes/users/@me/delete.ts
index 39ceefd9..c24c3f1e 100644
--- a/api/src/routes/users/@me/delete.ts
+++ b/api/src/routes/users/@me/delete.ts
@@ -7,7 +7,7 @@ import { HTTPError } from "lambert-server";
 const router = Router();
 
 router.post("/", route({}), async (req: Request, res: Response) => {
-	const user = await User.findOneOrFail({ id: req.user_id }); //User object
+	const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["data"] }); //User object
 	let correctpass = true;
 
 	if (user.data.hash) {
diff --git a/api/src/routes/users/@me/disable.ts b/api/src/routes/users/@me/disable.ts
index 259ced96..4aff3774 100644
--- a/api/src/routes/users/@me/disable.ts
+++ b/api/src/routes/users/@me/disable.ts
@@ -6,7 +6,7 @@ import bcrypt from "bcrypt";
 const router = Router();
 
 router.post("/", route({}), async (req: Request, res: Response) => {
-	const user = await User.findOneOrFail({ id: req.user_id }); //User object
+	const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["data"] }); //User object
 	let correctpass = true;
 
 	if (user.data.hash) {
diff --git a/api/src/routes/users/@me/relationships.ts b/api/src/routes/users/@me/relationships.ts
index 567c734e..0c13cdba 100644
--- a/api/src/routes/users/@me/relationships.ts
+++ b/api/src/routes/users/@me/relationships.ts
@@ -18,7 +18,11 @@ const router = Router();
 const userProjection: (keyof User)[] = ["relationships", ...PublicUserProjection];
 
 router.get("/", route({}), async (req: Request, res: Response) => {
-	const user = await User.findOneOrFail({ where: { id: req.user_id }, relations: ["relationships", "relationships.to"] });
+	const user = await User.findOneOrFail({
+		where: { id: req.user_id },
+		relations: ["relationships", "relationships.to"],
+		select: ["relationships"]
+	});
 
 	//TODO DTO
 	const related_users = user.relationships.map((r) => {