api/routes/modules/assignments/mark_allocator/mod.rs
1/// Mark Allocator route module.
2///
3/// This module defines HTTP routes for generating, loading, and saving mark allocator data.
4/// Each route is protected with middleware that ensures only lecturers can access them.
5
6use axum::{Router, routing::{get, post, put}};
7use get::load;
8use post::generate;
9use put::save;
10use util::state::AppState;
11
12pub mod get;
13pub mod post;
14pub mod put;
15
16/// Registers routes related to the mark allocator system.
17///
18/// The following endpoints are exposed at `/`:
19///
20/// - `POST /` → `generate` a new mark allocator based on memo output files.
21/// - `GET /` → `load` an existing allocator from disk.
22/// - `PUT /` → `save` updated allocator data to disk.
23///
24/// All routes require lecturer authentication using the `require_lecturer` middleware.
25pub fn mark_allocator_routes() -> Router<AppState> {
26 Router::new()
27 .route("/generate", post(generate))
28 .route("/", get(load))
29 .route("/", put(save))
30}