MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / del

Method del

packages/hydrooj/src/model/problem.ts:282–292  ·  view source on GitHub ↗
(domainId: string, docId: number)

Source from the content-addressed store, hash-verified

280 }
281
282 static async del(domainId: string, docId: number) {
283 await bus.parallel('problem/before-del', domainId, docId);
284 const res = await Promise.all([
285 document.deleteOne(domainId, document.TYPE_PROBLEM, docId),
286 document.deleteMultiStatus(domainId, document.TYPE_PROBLEM, { docId }),
287 storage.list(`problem/${domainId}/${docId}/`)
288 .then((items) => storage.del(items.map((item) => `problem/${domainId}/${docId}/${item.name}`))),
289 bus.parallel('problem/delete', domainId, docId),
290 ]);
291 return !!res[0][0].deletedCount;
292 }
293
294 static async addTestdata(domainId: string, pid: number, name: string, f: Readable | Buffer | string, operator = 1) {
295 name = name.trim();

Callers 2

delTestdataMethod · 0.45
delAdditionalFileMethod · 0.45

Calls 3

thenMethod · 0.80
allMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected