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

Method get

packages/hydrooj/src/handler/problem.ts:947–962  ·  view source on GitHub ↗
(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId)

Source from the content-addressed store, hash-verified

945 @route('psrid', Types.ObjectId, true)
946 @param('tid', Types.ObjectId, true)
947 async get(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId) {
948 if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
949 const accepted = this.psdoc?.status === STATUS.STATUS_ACCEPTED;
950 if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) {
951 this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
952 }
953 if (psrid) {
954 const [psdoc, psrdoc] = await solution.getReply(domainId, psid, psrid);
955 if ((!psdoc) || psdoc.parentId !== this.pdoc.docId) throw new SolutionNotFoundError(psid, psrid);
956 this.response.body = psrdoc.content;
957 } else {
958 const psdoc = await solution.get(domainId, psid);
959 this.response.body = psdoc.content;
960 }
961 this.response.type = 'text/markdown';
962 }
963}
964
965export class ProblemStatisticsHandler extends ProblemDetailHandler {

Callers

nothing calls this directly

Calls 4

hasPermMethod · 0.80
checkPermMethod · 0.80
getReplyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected