From 4105df8dcb825dd3d0ca048ca2bb09f9ada3d390 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:47:28 +0200 Subject: :bug: fix findOneAndUpdate --- api/src/routes/users/@me/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api/src/routes/users') diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index c073e78a..6ebc6634 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -38,7 +38,7 @@ router.patch("/", check(UserModifySchema), async (req: Request, res: Response) = 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 UserModel.findOneAndUpdate({ id: req.user_id }, body, { projection: UserUpdateProjection }).exec(); + const user = await UserModel.findOneAndUpdate({ id: req.user_id }, body, { projection: UserUpdateProjection, new: true }).exec(); // TODO: dispatch user update event res.json(toObject(user)); -- cgit 1.4.1