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

Method get

packages/hydrooj/src/handler/homework.ts:265–276  ·  view source on GitHub ↗
(domainId: string, tid: ObjectId)

Source from the content-addressed store, hash-verified

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)

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