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
@@ -51,7 +51,11 @@ async function edit(tid, $set) {
|
||||
if ($set.title) validator.checkTitle($set.title);
|
||||
if ($set.content) validator.checkIntro($set.content);
|
||||
if ($set.rule) { if (!this.RULES[$set.rule]) throw new ValidationError('rule'); }
|
||||
if ($set.beginAt && $set.endAt) if ($set.beginAt >= $set.endAt) throw new ValidationError('beginAt', 'endAt');
|
||||
if ($set.beginAt && $set.endAt) {
|
||||
if ($set.beginAt >= $set.endAt) {
|
||||
throw new ValidationError('beginAt', 'endAt');
|
||||
}
|
||||
}
|
||||
const tdoc = await coll.findOne({ tid });
|
||||
if (!tdoc) throw new ContestNotFoundError(tid);
|
||||
this.RULES[$set.rule || tdoc.rule].check(Object.assign(tdoc, $set));
|
||||
@@ -84,7 +88,8 @@ function getStatus(tid, uid) {
|
||||
}
|
||||
async function getListStatus(uid, tids) {
|
||||
const r = {};
|
||||
for (const tid of tids) r[tid] = await getStatus(tid, uid); // eslint-disable-line no-await-in-loop
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
for (const tid of tids) r[tid] = await getStatus(tid, uid);
|
||||
return r;
|
||||
}
|
||||
async function attend(tid, uid) {
|
||||
|
||||
Reference in new issue
Block a user