From d52d9c62fc30e31e2c01bf6b63f9aedebdde216f Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 8 Aug 2022 04:27:28 +0200 Subject: Bunch of fixes and improvements, everything appears to work now --- api/src/routes/users/@me/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'api/src/routes/users/@me/index.ts') diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index 92499689..6a2456d6 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -32,9 +32,7 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: const body = req.body as UserModifySchema; if (body.avatar) body.avatar = await handleFile(`/avatars/${req.user_id}`, body.avatar as string); - if (body.banner) body.banner = await handleFile(`/banners/${req.user_id}`, body.banner as string); - - const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] }); + if (body.banner) body.banner = await handleFile(`/banners/${req.user_id}`, body.banner as string);let user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] }); if (body.password) { if (user.data?.hash) { @@ -65,7 +63,7 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: } } - user.assign(body); + user = Object.assign(user, body); await user.save(); // @ts-ignore -- cgit 1.5.1