pub async fn get_submission(
__arg0: State<AppState>,
__arg1: Path<(i64, i64, i64)>,
__arg2: Extension<AuthUser>,
) -> impl IntoResponse
Expand description
GET /api/modules/{module_id}/assignments/{assignment_id}/submissions/{submission_id}
Retrieve a specific submission report for a given assignment. Accessible to users assigned to the module with appropriate permissions.
This endpoint validates that the submission belongs to the specified assignment and module, then
reads the submission_report.json
file associated with it. If the requesting user is not a
student, user metadata is included in the response.
§Path Parameters
module_id
(i64): The ID of the module containing the assignmentassignment_id
(i64): The ID of the assignment containing the submissionsubmission_id
(i64): The ID of the submission to retrieve
§Example Request
curl -X GET "http://localhost:3000/api/modules/1/assignments/2/submissions/123" \
-H "Authorization: Bearer <token>"
§Success Response (200 OK)
{
"success": true,
"message": "Submission details retrieved successfully",
"data": {
"id": 123,
"attempt": 1,
"filename": "assignment1.java",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"mark": {
"earned": 85,
"total": 100
},
"is_practice": false,
"is_late": false,
"tasks": [...],
"code_coverage": [...],
"code_complexity": {...},
"user": {
"user_id": 456,
"username": "student1",
"email": "[email protected]"
}
}
}
§Error Responses
404 Not Found - Submission, assignment, or module not found
{
"success": false,
"message": "Submission not found"
}
or
{
"success": false,
"message": "Assignment not found"
}
or
{
"success": false,
"message": "Assignment does not belong to the specified module"
}
or
{
"success": false,
"message": "Submission report not found"
}
500 Internal Server Error - Database or file read error
{
"success": false,
"message": "Database error"
}
or
{
"success": false,
"message": "Failed to parse submission report"
}
or
{
"success": false,
"message": "ASSIGNMENT_STORAGE_ROOT not set"
}
§Notes
- The submission report is read from the filesystem at:
ASSIGNMENT_STORAGE_ROOT/module_{module_id}/assignment_{assignment_id}/assignment_submissions/user_{user_id}/attempt_{attempt}/submission_report.json
- User metadata is only included for non-student users (lecturers, tutors, admins)
- The response contains the complete grading report including marks, tasks, and optional code coverage/complexity analysis
- Access is restricted to users with appropriate permissions for the module