refactor: update result schemas and tests for improved state management and feedback modes
Test / backend (push) Successful in 13s
Test / frontend (push) Successful in 24s
Release Pipeline / build-and-release (push) Failing after 6s

This commit is contained in:
LaurensBartelds committed 2026-04-26 23:54:56 +02:00
1 parent ae8a01bc54
commit 95603f93a0
4 files changed
+47 -46

No files matched your search

+2 -24
View File
@@ -1,7 +1,5 @@
import { z } from 'zod'
const answerValueSchema = z.union([z.string(), z.array(z.string()), z.record(z.string(), z.string())])
export const submitResultSchema = z.object({
exam_id: z.number().nullable().optional(),
title: z.string().min(1),
@@ -11,28 +9,8 @@ export const submitResultSchema = z.object({
graded_count: z.number(),
passing_score: z.number().optional(),
elapsed_ms: z.number(),
state: z.object({
answers: z.record(z.string(), answerValueSchema),
gradedAnswers: z.record(z.string(), z.object({
correct: z.boolean(),
points: z.number(),
explanation: z.string().optional(),
})),
answeredCount: z.number(),
score: z.number(),
correctCount: z.number(),
gradedCount: z.number(),
timeExpired: z.boolean().optional(),
}),
exam: z.object({
id: z.string().optional(),
title: z.string(),
subtitle: z.string().optional(),
questions: z.array(z.any()),
timeLimitMinutes: z.number().nullable().optional(),
passingScore: z.number().optional(),
feedbackMode: z.enum(['end', 'immediate']).optional(),
}).passthrough(),
state: z.record(z.unknown()),
exam: z.record(z.unknown()),
})
export const resultIdParamSchema = z.object({