diff options
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/routes/users/@me/settings.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/api/routes/users/@me/settings.ts b/src/api/routes/users/@me/settings.ts index 8fb86012..0fd8220a 100644 --- a/src/api/routes/users/@me/settings.ts +++ b/src/api/routes/users/@me/settings.ts @@ -7,7 +7,7 @@ const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { const user = await User.findOneOrFail({ where: { id: req.user_id }, - select: ["settings"], + relations: ["settings"], }); return res.json(user.settings); }); @@ -21,10 +21,12 @@ router.patch( const user = await User.findOneOrFail({ where: { id: req.user_id, bot: false }, - select: ["settings"] + relations: ["settings"] }); - user.settings = OrmUtils.mergeDeep(user.settings, body); - User.update({ id: user.id }, { settings: user.settings }); + + user.settings.assign(body); + + user.settings.save(); res.json(user.settings); }, |