pub async fn get_assignment(
__arg0: State<AppState>,
__arg1: Path<(i64, i64)>,
) -> impl IntoResponse
Expand description
GET /api/modules/{module_id}/assignments/{assignment_id}
Retrieve a specific assignment along with its associated files. Accessible to users assigned to the module.
§Path Parameters
module_id
(i64): The ID of the module containing the assignmentassignment_id
(i64): The ID of the assignment to retrieve
§Responses
200 OK
{
"success": true,
"message": "Assignment retrieved successfully",
"data": {
"assignment": {
"id": 123,
"module_id": 456,
"name": "Assignment 1",
"description": "This is a sample assignment",
"assignment_type": "Assignment",
"available_from": "2024-01-01T00:00:00Z",
"due_date": "2024-01-31T23:59:59Z",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
},
"files": [
{
"id": "789",
"filename": "assignment.pdf",
"path": "module_456/assignment_123/assignment.pdf",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
]
}
}
404 Not Found
{
"success": false,
"message": "Assignment not found"
}
500 Internal Server Error
{
"success": false,
"message": "Failed to retrieve files: <error details>" // or "An error occurred: <error details>"
}