mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
优化结构
This commit is contained in:
1 parent
75ebc1a746
commit
2554cf660a
34 files changed
+401
-150
No files matched your search
@@ -27,12 +27,12 @@ async function enroll(tid, uid) {
|
||||
} catch (e) {
|
||||
throw new TrainingAlreadyEnrollError(tid, uid);
|
||||
}
|
||||
await coll.findOneAndUpdate({ _id: tid }, { $inc: { enroll: 1 } });
|
||||
await coll.updateOne({ _id: tid }, { $inc: { enroll: 1 } });
|
||||
}
|
||||
|
||||
async function setStatus(tid, uid, $set) {
|
||||
await collStatus.findOneAndUpdate({ tid, uid }, { $set });
|
||||
return await collStatus.findOne({ tid, uid });
|
||||
await collStatus.updateOne({ tid, uid }, { $set });
|
||||
return await collStatus.findOne({ tid, uid }); // eslint-disable-line no-return-await
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in new issue
Block a user