mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 09:38:19 +08:00
core: add contest/before-edit
This commit is contained in:
2 files changed
+2
No files matched your search
@@ -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);
|
||||
|
||||
@@ -85,6 +85,7 @@ export interface EventMap {
|
||||
|
||||
'contest/before-add': (payload: Partial<Tdoc>) => VoidReturn;
|
||||
'contest/add': (payload: Partial<Tdoc>, id: ObjectId) => VoidReturn;
|
||||
'contest/before-edit': (tdoc: Tdoc, $set: Partial<Tdoc>) => VoidReturn;
|
||||
'contest/edit': (payload: Tdoc) => VoidReturn;
|
||||
'contest/list': (query: Filter<Tdoc>, handler: any) => VoidReturn;
|
||||
'contest/scoreboard': (tdoc: Tdoc, rows: ScoreboardRow[], udict: BaseUserDict, pdict: ProblemDict) => VoidReturn;
|
||||
|
||||
Reference in new issue
Block a user