MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / get

Method get

packages/hydrooj/src/handler/training.ts:248–259  ·  view source on GitHub ↗
(domainId: string, tid: ObjectId)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 6

sortFilesFunction · 0.90
ownMethod · 0.80
checkPermMethod · 0.80
getByIdMethod · 0.80
urlMethod · 0.80
getStatusMethod · 0.45

Tested by

no test coverage detected