优化结构

This commit is contained in:
undefined committed 2020-04-30 18:07:35 +08:00
1 parent 75ebc1a746
commit 2554cf660a
34 files changed
+401 -150

No files matched your search

+3 -3
View File
@@ -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 = {