core: add contest/before-edit

This commit is contained in:
undefined committed 2025-10-17 19:07:25 +08:00
1 parent f5ef8b7f38
commit 2858e96414
2 files changed
+2

No files matched your search

+1
View File
@@ -824,6 +824,7 @@ export async function edit(domainId: string, tid: ObjectId, $set: Partial<Tdoc>)
if ($set.rule && !RULES[$set.rule]) throw new ValidationError('rule');
const tdoc = await document.get(domainId, document.TYPE_CONTEST, tid);
if (!tdoc) throw new ContestNotFoundError(domainId, tid);
await bus.parallel('contest/before-edit', tdoc, $set);
RULES[$set.rule || tdoc.rule].check(Object.assign(tdoc, $set));
const res = await document.set(domainId, document.TYPE_CONTEST, tid, $set);
await bus.parallel('contest/edit', res);