Function get_assignment_config

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

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

Retrieve the JSON configuration object associated with a specific assignment. Accessible to users assigned to the module with appropriate permissions.

The configuration object is loaded from disk using the [ExecutionConfig] schema. If no configuration file is present on disk, an empty config is returned instead.

§Path Parameters

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

§Example Request

curl -X GET http://localhost:3000/api/modules/1/assignments/2/config \
  -H "Authorization: Bearer <token>"

§Success Response (200 OK) - With Configuration

{
  "success": true,
  "message": "Assignment configuration retrieved successfully",
  "data": {
    "execution": {
      "timeout_secs": 10,
      "max_memory": 8589934592,
      "max_cpus": 2,
      "max_uncompressed_size": 100000000,
      "max_processes": 256
    },
    "marking": {
      "marking_scheme": "exact",
      "feedback_scheme": "auto",
      "deliminator": "&-=-&"
    }
  }
}

§Success Response (200 OK) - No Configuration File

{
  "success": true,
  "message": "No configuration set for this assignment",
  "data": {}
}

§Error Responses

  • 404 – Assignment not found
  • 500 – Failed to load configuration from disk

§Notes

  • Configurations are stored on disk under ASSIGNMENT_STORAGE_ROOT/module_{id}/assignment_{id}/config/config.json
  • Config format uses [ExecutionConfig] as the schema
  • This is an example schema and will evolve over time