🐛 fix findOneAndUpdate
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user