| 263 | |
| 264 | @param('tid', Types.ObjectId) |
| 265 | async get(domainId: string, tid: ObjectId) { |
| 266 | if (!this.user.own(this.tdoc)) this.checkPerm(PERM.PERM_EDIT_HOMEWORK); |
| 267 | this.response.body = { |
| 268 | tdoc: this.tdoc, |
| 269 | tsdoc: await contest.getStatus(domainId, this.tdoc.docId, this.user._id), |
| 270 | udoc: await user.getById(domainId, this.tdoc.owner), |
| 271 | files: sortFiles(this.tdoc.files || []), |
| 272 | urlForFile: (filename: string) => this.url('homework_file_download', { tid, filename, type: 'public' }), |
| 273 | }; |
| 274 | this.response.pjax = 'partials/files.html'; |
| 275 | this.response.template = 'homework_files.html'; |
| 276 | } |
| 277 | |
| 278 | @param('tid', Types.ObjectId) |
| 279 | @post('filename', Types.Filename, true) |