(domainId: string, tid: ObjectId)
| 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 | |
| 189 | class TrainingEditHandler extends Handler { |