Function upload_interpreter

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

POST /api/modules/{module_id}/assignments/{assignment_id}/interpreter

Upload an interpreter file for an assignment. Only one interpreter may exist per assignment. Existing interpreters with the same filename will be overwritten.

§Path Parameters

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

§Request Body (Multipart Form Data)

  • command (string, required): The command to execute the interpreter (e.g., “python3 main.py”)
  • file (file, required): The interpreter file to upload

§Responses

  • 201 Created → success with metadata
  • 400 Bad Request → missing command/file, empty file, multiple files, etc.
  • 500 Internal Server Error → database or file write errors