Function interpreter_routes

Source
pub fn interpreter_routes(app_state: AppState) -> Router<AppState>
Expand description

Registers the routes for assignment file endpoints.

This function sets up the following endpoints under the current router:

  • POST /: Upload files to an assignment. Access is restricted to lecturers assigned to the module.
  • GET /: List all files for an assignment. Access is restricted to lecturers assigned to the module.
  • GET /{file_id}: Download a specific file from an assignment. Access is restricted to lecturers assigned to the module.
  • DELETE /: Delete files from an assignment. Access is restricted to lecturers assigned to the module.

Routes apply appropriate middleware based on the operation:

  • Upload and delete operations require lecturer permissions
  • List and download operations require module assignment

ยงReturns

An [axum::Router] with the file endpoints and their associated middleware.