pub fn tasks_routes() -> Router<AppState>
Expand description
Registers the routes for assignment task endpoints.
This function sets up the following endpoints under the current router:
GET /
: Lists all tasks for the assignment. Access is restricted to users with lecturer or admin roles for the assignment.POST /
: Creates a new task for the assignment. Access is restricted to users with lecturer or admin roles for the assignment.GET /{task_id}
: Retrieves detailed information about a specific task. Access is restricted to users with lecturer or admin roles for the assignment.PUT /{task_id}
: Edits the command of a specific task. Access is restricted to users with lecturer or admin roles for the assignment.DELETE /{task_id}
: Deletes a specific task from the assignment. Access is restricted to users with lecturer or admin roles for the assignment.
All routes apply the require_lecturer_or_admin
middleware, which checks the user’s role for the assignment before allowing access.
§Returns
An [axum::Router
] with the task endpoints and their associated middleware.