{ "openapi": "3.0.1", "info": { "title": "API V1", "version": "v1" }, "paths": { "/api/user_assignments/{userAssignmentId}/questions": { "get": { "summary": "Returns all assignment questions for a given user assignment, including user responses if present", "tags": [ "UserAssignmentQuestions" ], "parameters": [ { "name": "userAssignmentId", "in": "path", "description": "User Assignment ID", "required": true, "schema": { "type": "string" } }, { "name": "userAssignmentSessionId", "in": "query", "required": true, "description": "User Assignment Session ID (must be active)", "schema": { "type": "string" } } ], "responses": { "200": { "description": "questions found", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "questionId": { "type": "integer" }, "content": { "type": "string" }, "choices": { "type": "array", "items": { "type": "string" }, "nullable": true }, "response": { "type": "string", "nullable": true }, "points": { "type": "integer" } }, "required": [ "questionId", "content", "choices", "response", "points" ] } } } } }, "400": { "description": "userAssignmentSessionId is missing" }, "403": { "description": "session is invalid or closed" }, "404": { "description": "user assignment not found" } } }, "post": { "summary": "Creates a user assignment question response", "tags": [ "UserAssignmentQuestions" ], "parameters": [ { "name": "userAssignmentId", "in": "path", "description": "User Assignment ID", "required": true, "schema": { "type": "string" } } ], "responses": { "201": { "description": "response saved", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } }, "required": [ "success" ] } } } }, "400": { "description": "missing required params", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "user assignment or assignment question not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "unprocessable entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } }, "required": [ "success" ] } } } }, "502": { "description": "LLM grading failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "details": { "type": "string" } }, "required": [ "error", "details" ] } } } } }, "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "assignmentQuestionId": { "type": "integer" }, "response": { "type": "string" } }, "required": [ "assignmentQuestionId", "response" ] } } } } } }, "/api/user_assignment_sessions": { "post": { "summary": "create user_assignment_session", "tags": [ "UserAssignmentSessions" ], "parameters": [], "responses": { "201": { "description": "created", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "userAssignmentSessionId": { "type": "integer" } }, "required": [ "success", "userAssignmentSessionId" ] } } } }, "404": { "description": "not found" }, "422": { "description": "unprocessable entity" } }, "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "userAssignmentId": { "type": "integer" } }, "required": [ "userAssignmentId" ] } } } } } }, "/api/user_assignment_sessions/{id}": { "patch": { "summary": "update user_assignment_session", "tags": [ "UserAssignmentSessions" ], "parameters": [ { "name": "id", "in": "path", "description": "UserAssignmentSession ID", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } }, "required": [ "success" ] } } } }, "404": { "description": "not found" }, "422": { "description": "unprocessable entity" } } } }, "/api/user_assignments": { "get": { "summary": "list user_assignments", "tags": [ "UserAssignments" ], "parameters": [ { "name": "userId", "in": "query", "description": "User ID", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "userAssignmentId": { "type": "integer" }, "title": { "type": "string" }, "status": { "type": "string" }, "score": { "type": "integer", "nullable": true }, "totalTimeSpent": { "type": "integer", "nullable": true, "description": "Total time spent in seconds" }, "possibleScore": { "type": "integer", "description": "Total possible score for the assignment" }, "results": { "type": "object", "nullable": true, "properties": { "totalQuestions": { "type": "integer" }, "totalCorrect": { "type": "integer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "content": { "type": "string" }, "response": { "type": "string" }, "correct": { "type": "boolean" }, "points": { "type": "integer" }, "gradeExplanation": { "type": "string", "nullable": true } }, "required": [ "id", "content", "response", "correct", "points", "gradeExplanation" ] } } }, "required": [ "totalQuestions", "totalCorrect", "questions" ] } }, "required": [ "userAssignmentId", "title", "status", "possibleScore" ] } } } } } } } }, "/api/user_assignments/{id}": { "get": { "summary": "show user_assignment", "tags": [ "UserAssignments" ], "parameters": [ { "name": "id", "in": "path", "description": "UserAssignment ID", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "userAssignmentId": { "type": "integer" }, "title": { "type": "string" }, "status": { "type": "string" }, "score": { "type": "integer", "nullable": true }, "totalTimeSpent": { "type": "integer", "nullable": true, "description": "Total time spent in seconds" }, "possibleScore": { "type": "integer", "description": "Total possible score for the assignment" }, "results": { "type": "object", "nullable": true, "properties": { "totalQuestions": { "type": "integer" }, "totalCorrect": { "type": "integer" }, "questions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "content": { "type": "string" }, "response": { "type": "string" }, "correct": { "type": "boolean" }, "points": { "type": "integer" }, "gradeExplanation": { "type": "string", "nullable": true } }, "required": [ "id", "content", "response", "correct", "points", "gradeExplanation" ] } } }, "required": [ "totalQuestions", "totalCorrect", "questions" ] } }, "required": [ "userAssignmentId", "title", "status", "possibleScore" ] } } } }, "404": { "description": "not found" } } } }, "/api/users": { "get": { "summary": "list users", "responses": { "200": { "description": "successful", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "email": { "type": "string" } }, "required": [ "id", "name", "email" ] } } } } } } } } }, "servers": [ { "url": "http://localhost:3000" } ] }