mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-06 06:39:18 -05:00
feat(api): add attempt id and exam id to response (#61637)
This commit is contained in:
@@ -849,6 +849,8 @@ describe('/exam-environment/', () => {
|
||||
);
|
||||
|
||||
const examEnvironmentExamAttempt = {
|
||||
id: attempt.id,
|
||||
examId: mock.exam.id,
|
||||
result: null,
|
||||
startTimeInMS: attempt.startTimeInMS,
|
||||
questionSets: attempt.questionSets
|
||||
@@ -887,6 +889,8 @@ describe('/exam-environment/', () => {
|
||||
);
|
||||
|
||||
const examEnvironmentExamAttempt = {
|
||||
id: attempt.id,
|
||||
examId: mock.exam.id,
|
||||
result: null,
|
||||
startTimeInMS: attempt.startTimeInMS,
|
||||
questionSets: attempt.questionSets
|
||||
@@ -919,6 +923,8 @@ describe('/exam-environment/', () => {
|
||||
);
|
||||
|
||||
const examEnvironmentExamAttempt = {
|
||||
id: attempt.id,
|
||||
examId: mock.exam.id,
|
||||
result: {
|
||||
score: 25,
|
||||
passingPercent: 80
|
||||
@@ -975,6 +981,8 @@ describe('/exam-environment/', () => {
|
||||
);
|
||||
|
||||
const examEnvironmentExamAttempt = {
|
||||
id: attempt.id,
|
||||
examId: mock.exam.id,
|
||||
result: null,
|
||||
startTimeInMS: attempt.startTimeInMS,
|
||||
questionSets: attempt.questionSets
|
||||
@@ -1003,6 +1011,8 @@ describe('/exam-environment/', () => {
|
||||
);
|
||||
|
||||
const examEnvironmentExamAttempt = {
|
||||
id: attempt.id,
|
||||
examId: mock.exam.id,
|
||||
result: null,
|
||||
startTimeInMS: attempt.startTimeInMS,
|
||||
questionSets: attempt.questionSets
|
||||
@@ -1033,6 +1043,8 @@ describe('/exam-environment/', () => {
|
||||
);
|
||||
|
||||
const examEnvironmentExamAttempt = {
|
||||
id: attempt.id,
|
||||
examId: mock.exam.id,
|
||||
result: {
|
||||
score: 25,
|
||||
passingPercent: 80
|
||||
|
||||
@@ -27,6 +27,8 @@ export const examEnvironmentPostExamAttempt = {
|
||||
};
|
||||
|
||||
const examEnvAttempt = Type.Object({
|
||||
id: Type.String(),
|
||||
examId: Type.String(),
|
||||
startTimeInMS: Type.Number(),
|
||||
questionSets: Type.Array(
|
||||
Type.Object({
|
||||
@@ -51,7 +53,9 @@ const examEnvAttempt = Type.Object({
|
||||
|
||||
export const examEnvironmentGetExamAttempts = {
|
||||
headers: Type.Object({
|
||||
'exam-environment-authorization-token': Type.String()
|
||||
// Optional, because the handler is used in both the `/user/` base and `/exam-environment/` base
|
||||
// If it is missing, auth will catch.
|
||||
'exam-environment-authorization-token': Type.Optional(Type.String())
|
||||
}),
|
||||
response: {
|
||||
200: Type.Array(examEnvAttempt),
|
||||
@@ -64,7 +68,9 @@ export const examEnvironmentGetExamAttempt = {
|
||||
attemptId: Type.String({ format: 'objectid' })
|
||||
}),
|
||||
headers: Type.Object({
|
||||
'exam-environment-authorization-token': Type.String()
|
||||
// Optional, because the handler is used in both the `/user/` base and `/exam-environment/` base.
|
||||
// If it is missing, auth will catch.
|
||||
'exam-environment-authorization-token': Type.Optional(Type.String())
|
||||
}),
|
||||
response: {
|
||||
200: examEnvAttempt,
|
||||
|
||||
@@ -932,5 +932,5 @@ export async function constructEnvExamAttempt(
|
||||
}
|
||||
|
||||
function omitAttemptReferenceIds(attempt: ExamEnvironmentExamAttempt) {
|
||||
return omit(attempt, ['examId', 'id', 'generatedExamId', 'userId']);
|
||||
return omit(attempt, ['generatedExamId', 'userId']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user