Delete a question from a quiz (ASK-119)
DELETE/quizzes/:quiz_id/questions/:question_id
Hard-delete one question from a quiz. The quiz_answer_options
for the question CASCADE-delete; references from
practice_session_questions.question_id and
practice_answers.question_id are SET NULL so historical
session data is preserved with a NULL question reference.
A quiz must always carry at least 1 question; an attempt to
delete the last remaining question returns 400 with
"quiz must have at least 1 question". The count check runs
inside the same transaction as the delete so two concurrent
deletes on a 2-question quiz can't both succeed.
Authorization: creator-only. The authenticated user must be
quizzes.creator_id; any other authenticated user gets 403.
404 covers all of: quiz missing/soft-deleted, parent study guide soft-deleted, question missing, question belonging to a different quiz.
quizzes.updated_at is refreshed on every successful delete.
Request
Responses
- 204
- 400
- 401
- 403
- 404
- 500
Question deleted
Bad request
Unauthorized
Forbidden
Not found
Internal server error