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

Method postDelete

packages/hydrooj/src/handler/training.ts:178–186  ·  view source on GitHub ↗
(domainId: string, tid: ObjectId)

Source from the content-addressed store, hash-verified

176
177 @param('tid', Types.ObjectId)
178 async postDelete(domainId: string, tid: ObjectId) {
179 const tdoc = await training.get(domainId, tid);
180 if (!this.user.own(tdoc)) this.checkPerm(PERM.PERM_EDIT_TRAINING);
181 await Promise.all([
182 training.del(domainId, tid),
183 storage.del(tdoc.files?.map((i) => `training/${domainId}/${tid}/${i.name}`) || [], this.user._id),
184 ]);
185 this.response.redirect = this.url('training_main');
186 }
187}
188
189class TrainingEditHandler extends Handler {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected