| 556 | @param('d', Types.Range(['public', 'private']), true) |
| 557 | @param('sidebar', Types.Boolean) |
| 558 | async get(domainId: string, tid: ObjectId, d?: string, sidebar?: boolean) { |
| 559 | this.response.body = { |
| 560 | tdoc: this.tdoc, |
| 561 | tsdoc: this.tsdoc, |
| 562 | owner_udoc: await user.getById(domainId, this.tdoc.owner), |
| 563 | pdict: await problem.getList(domainId, this.tdoc.pids, true, true, [...problem.PROJECTION_CONTEST_LIST, 'tag']), |
| 564 | files: sortFiles(this.tdoc.files || []), |
| 565 | privateFiles: sortFiles(this.tdoc.privateFiles || []), |
| 566 | urlForFile: (filename: string, type: string) => this.url('contest_file_download', { tid, filename, type }), |
| 567 | }; |
| 568 | this.response.pjax = [ |
| 569 | ...((!d || d === 'public') ? [['partials/files.html', { filetype: 'public', sidebar }] as const] : []), |
| 570 | ...((!d || d === 'private') ? [['partials/files.html', { |
| 571 | files: this.response.body.privateFiles, |
| 572 | filetype: 'private', |
| 573 | sidebar, |
| 574 | }] as const] : []), |
| 575 | ]; |
| 576 | this.response.template = 'contest_manage.html'; |
| 577 | } |
| 578 | |
| 579 | @param('tid', Types.ObjectId) |
| 580 | @post('filename', Types.Filename, true) |