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

Method postDelete

packages/hydrooj/src/handler/homework.ts:242–251  ·  view source on GitHub ↗
(domainId: string, tid: ObjectId)

Source from the content-addressed store, hash-verified

240
241 @param('tid', Types.ObjectId)
242 async postDelete(domainId: string, tid: ObjectId) {
243 const tdoc = await contest.get(domainId, tid);
244 if (!this.user.own(tdoc)) this.checkPerm(PERM.PERM_EDIT_HOMEWORK);
245 await Promise.all([
246 record.updateMulti(domainId, { domainId, contest: tid }, undefined, undefined, { contest: '' }),
247 contest.del(domainId, tid),
248 storage.del(tdoc.files?.map((i) => `contest/${domainId}/${tid}/public/${i.name}`) || [], this.user._id),
249 ]);
250 this.response.redirect = this.url('homework_main');
251 }
252}
253
254export class HomeworkFilesHandler extends Handler {

Callers

nothing calls this directly

Calls 7

ownMethod · 0.80
checkPermMethod · 0.80
updateMultiMethod · 0.80
urlMethod · 0.80
getMethod · 0.45
allMethod · 0.45
delMethod · 0.45

Tested by

no test coverage detected