mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: update hook usage
This commit is contained in:
1 parent
ab933bc9d5
commit
757b5e6bc1
27 files changed
+63
-64
No files matched your search
@@ -115,7 +115,7 @@ export class ProblemModel {
|
||||
title, tag, hidden, assign, nSubmit: 0, nAccept: 0, sort: sortable(pid || `P${docId}`),
|
||||
};
|
||||
if (pid) args.pid = pid;
|
||||
await bus.serial('problem/before-add', domainId, content, owner, docId, args);
|
||||
await bus.parallel('problem/before-add', domainId, content, owner, docId, args);
|
||||
const result = await document.add(domainId, content, owner, document.TYPE_PROBLEM, docId, null, null, args);
|
||||
args.content = content;
|
||||
args.owner = owner;
|
||||
@@ -193,7 +193,7 @@ export class ProblemModel {
|
||||
} else if ($set.pid) {
|
||||
$set.sort = sortable($set.pid);
|
||||
}
|
||||
await bus.serial('problem/before-edit', $set);
|
||||
await bus.parallel('problem/before-edit', $set);
|
||||
const result = await document.set(domainId, document.TYPE_PROBLEM, _id, $set, delpid ? { pid: '' } : undefined);
|
||||
await bus.emit('problem/edit', result);
|
||||
return result;
|
||||
@@ -230,7 +230,7 @@ export class ProblemModel {
|
||||
}
|
||||
|
||||
static async del(domainId: string, docId: number) {
|
||||
await bus.serial('problem/before-del', domainId, docId);
|
||||
await bus.parallel('problem/before-del', domainId, docId);
|
||||
const res = await Promise.all([
|
||||
document.deleteOne(domainId, document.TYPE_PROBLEM, docId),
|
||||
document.deleteMultiStatus(domainId, document.TYPE_PROBLEM, { docId }),
|
||||
|
||||
Reference in new issue
Block a user