mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: feat: problem_delete
This commit is contained in:
1 parent
3d9acf2c1a
commit
1543a374e3
12 files changed
+151
-174
No files matched your search
@@ -9,6 +9,7 @@ import { Content } from '../loader';
|
||||
import { ArrayKeys, NumberKeys, Projection } from '../typeutils';
|
||||
import { ProblemNotFoundError } from '../error';
|
||||
import storage from '../service/storage';
|
||||
import * as bus from '../service/bus';
|
||||
|
||||
export interface Pdoc {
|
||||
_id: ObjectID
|
||||
@@ -207,6 +208,11 @@ export function setStar(domainId: string, pid: number, uid: number, star: boolea
|
||||
return document.setStatus(domainId, document.TYPE_PROBLEM, pid, uid, { star });
|
||||
}
|
||||
|
||||
bus.on('problem/delete', (domainId, docId) => Promise.all([
|
||||
document.deleteOne(domainId, document.TYPE_PROBLEM, docId),
|
||||
document.deleteMultiStatus(domainId, document.TYPE_PROBLEM, { docId }),
|
||||
]));
|
||||
|
||||
global.Hydro.model.problem = {
|
||||
Pdoc,
|
||||
|
||||
|
||||
Reference in new issue
Block a user