| 246 | |
| 247 | @param('tid', Types.ObjectId) |
| 248 | async get(domainId: string, tid: ObjectId) { |
| 249 | if (!this.user.own(this.tdoc)) this.checkPerm(PERM.PERM_EDIT_TRAINING); |
| 250 | this.response.body = { |
| 251 | tdoc: this.tdoc, |
| 252 | tsdoc: await training.getStatus(domainId, this.tdoc.docId, this.user._id), |
| 253 | udoc: await user.getById(domainId, this.tdoc.owner), |
| 254 | files: sortFiles(this.tdoc.files || []), |
| 255 | urlForFile: (filename: string) => this.url('training_file_download', { tid, filename }), |
| 256 | }; |
| 257 | this.response.pjax = 'partials/files.html'; |
| 258 | this.response.template = 'training_files.html'; |
| 259 | } |
| 260 | |
| 261 | @param('tid', Types.ObjectId) |
| 262 | @post('filename', Types.Filename, true) |