diff --git a/api/src/exam-environment/routes/exam-environment.ts b/api/src/exam-environment/routes/exam-environment.ts index cf4be5f401c..5c0adc3cbd7 100644 --- a/api/src/exam-environment/routes/exam-environment.ts +++ b/api/src/exam-environment/routes/exam-environment.ts @@ -812,7 +812,7 @@ async function getExams( * * If an attempt is completed, the result is included. */ -async function getExamAttemptsHandler( +export async function getExamAttemptsHandler( this: FastifyInstance, req: UpdateReqType, reply: FastifyReply @@ -872,7 +872,7 @@ async function getExamAttemptsHandler( * * If the attempt is completed, the result is included. */ -async function getExamAttemptHandler( +export async function getExamAttemptHandler( this: FastifyInstance, req: UpdateReqType, reply: FastifyReply diff --git a/api/src/routes/protected/user.ts b/api/src/routes/protected/user.ts index 82b5dc33dd6..8541c70c97a 100644 --- a/api/src/routes/protected/user.ts +++ b/api/src/routes/protected/user.ts @@ -6,6 +6,7 @@ import jwt from 'jsonwebtoken'; import { PrismaClientKnownRequestError } from '@prisma/client/runtime/library'; import * as schemas from '../../schemas'; +import * as examEnvironmentSchemas from '../../exam-environment/schemas'; import { createResetProperties } from '../../utils/create-user'; import { customNanoid } from '../../utils/ids'; import { encodeUserToken } from '../../utils/tokens'; @@ -27,6 +28,10 @@ import { ProgressTimestamp } from '../../utils/progress'; import { JWT_SECRET } from '../../utils/env'; +import { + getExamAttemptHandler, + getExamAttemptsHandler +} from '../../exam-environment/routes/exam-environment'; /** * Helper function to get the api url from the shared transcript link. @@ -475,6 +480,21 @@ export const userRoutes: FastifyPluginCallbackTypebox = ( examEnvironmentTokenHandler ); + fastify.get( + '/user/exam-environment/exam/attempts', + { + schema: examEnvironmentSchemas.examEnvironmentGetExamAttempts + }, + getExamAttemptsHandler + ); + fastify.get( + '/user/exam-environment/exam/attempt/:attemptId', + { + schema: examEnvironmentSchemas.examEnvironmentGetExamAttempt + }, + getExamAttemptHandler + ); + done(); };