mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
problem pretest
This commit is contained in:
1 parent
dd5a212422
commit
554698189c
17 files changed
+127
-57
No files matched your search
@@ -132,6 +132,7 @@ async function changePassword(uid, currentPassword, newPassword) {
|
||||
|
||||
async function inc(_id, field, n = 1) {
|
||||
const udoc = await coll.findOne({ _id });
|
||||
if (!udoc) throw new UserNotFoundError(_id);
|
||||
udoc[field] = udoc[field] + n || n;
|
||||
await coll.updateOne({ _id }, { $set: { [field]: udoc[field] } });
|
||||
return udoc;
|
||||
|
||||
Reference in new issue
Block a user