Function download_file

Source
pub async fn download_file(
    __arg0: State<AppState>,
    __arg1: Path<(i64, i64, i64)>,
) -> Response
Expand description

GET /api/modules/{module_id}/assignments/{assignment_id}/files/{file_id}

Download a specific file from an assignment. Accessible to users 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 containing the file
  • file_id (i64): The ID of the file to download

§Responses

  • 200 OK: Returns the file as a binary attachment with appropriate headers
  • 404 Not Found
{
  "success": false,
  "message": "File not found" // or "File missing on disk"
}
  • 500 Internal Server Error
{
  "success": false,
  "message": "Database error" // or "Could not open file" or "Failed to read file"
}