diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-18 11:47:28 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-18 11:47:28 +0200 |
commit | 4105df8dcb825dd3d0ca048ca2bb09f9ada3d390 (patch) | |
tree | dff83a75ad8cb2fef29aac520005bf2c2accf9f2 /api/src/routes/users/@me | |
parent | fix #199 (diff) | |
download | server-4105df8dcb825dd3d0ca048ca2bb09f9ada3d390.tar.xz |
:bug: fix findOneAndUpdate
Diffstat (limited to 'api/src/routes/users/@me')
-rw-r--r-- | api/src/routes/users/@me/index.ts | 2 |
1 files changed, 1 insertions, 1 deletions
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)); |