| 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 | |
| 254 | export class HomeworkFilesHandler extends Handler { |