Function list_tasks

Source
pub async fn list_tasks(
    __arg0: State<AppState>,
    __arg1: Path<(i64, i64)>,
) -> impl IntoResponse
Expand description

GET /api/modules/{module_id}/assignments/{assignment_id}/tasks

Retrieve all tasks for a specific assignment. Only accessible by lecturers or admins assigned to the module.

§Path Parameters

  • module_id (i64): The ID of the module containing the assignment
  • assignment_id (i64): The ID of the assignment to list tasks for

§Responses

  • 200 OK
{
  "success": true,
  "message": "Tasks retrieved successfully",
  "data": [
    {
      "id": 123,
      "task_number": 1,
      "command": "java -cp . Main",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    },
    {
      "id": 124,
      "task_number": 2,
      "command": "python main.py",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ]
}
  • 404 Not Found
{
  "success": false,
  "message": "Assignment or module not found"
}
  • 500 Internal Server Error
{
  "success": false,
  "message": "Database error" // or "Failed to retrieve tasks"
}