fix: validate quiz submissions based on question type#424
Conversation
|
@Dhyeya29 is attempting to deploy a commit to the Adarsh's projects Team on Vercel. A member of the Team first needs to authorize it. |
MRIARC-08
left a comment
There was a problem hiding this comment.
@Dhyeya29 The validation logic is aligned with the question type contract, and the branch merges cleanly with current main.
Local checks:
pnpm exec tsc --noEmitpasses.pnpm testpasses: 8 files / 35 tests.pnpm exec eslint src/modules/quiz/quiz.repository.ts src/modules/quiz/quiz.service.tsfails on one Prettier formatting issue insrc/modules/quiz/quiz.service.ts.
Please run the repo formatter on the touched quiz files and push that result. No logic rewrite needed from what I checked.
|
Thank you for the contribution! However, this PR currently has merge conflicts. Could you please resolve them so we can proceed with the review and merge? |
|
Not mergeable right now: this branch has merge conflicts with |
|
Currently not mergeable due to conflicts with |
|
Hey! Thanks for the PR. It looks like there are some merge conflicts. Could you please resolve them so we can proceed with the merge? |
Closes #280
Summary
This PR strengthens server-side validation for quiz submissions by ensuring responses match the expected question type before they are processed and stored.
Changes Made
Updated the question lookup to fetch the corresponding question type during submission.
Added validation to ensure:
Returns a
400 Bad Requestfor invalid quiz submissions before persisting response records.Why
Although quiz submissions already validate the existence of questions and selected options, they did not verify that the submitted response matched the expected question type. This change adds an additional validation layer to prevent invalid quiz records from being stored.
Validation
pnpm build.