api/routes/me/mod.rs
1//! # Me Routes Module
2//!
3//! Defines and wires up routes for user-specific endpoints, such as announcements, tickets, and assignments.
4//!
5//! ## Structure
6//! - `announcements.rs` — GET handlers for fetching the user's announcements
7//! - `assignments.rs` — GET handlers for fetching the user's assignments
8//! - `tickets.rs` — GET handlers for fetching the user's tickets
9//! - `grades.rs` — GET handlers for fetching the user's grades
10//! - `submissions.rs` — GET handlers for fetching the user's submissions
11//! - `events.rs` — GET handlers for fetching the user's events
12//!
13//! ## Usage
14//! Call `me_routes()` to get a configured `Router` for `/me` endpoints to be mounted in the main app.
15
16use axum::{routing::get, Router};
17use util::state::AppState;
18
19pub mod announcements;
20pub mod assignments;
21pub mod tickets;
22pub mod grades;
23pub mod submissions;
24pub mod events;
25
26/// Builds and returns the `/me` route group.
27///
28/// Routes:
29/// - `GET /me/announcements` → fetch announcements for the logged-in user
30/// - `GET /me/tickets` → fetch tickets for the logged-in user
31/// - `GET /me/assignments` → fetch assignments for the logged-in user
32/// - `GET /me/grades` → fetch grades for the logged-in user
33/// - `GET /me/submissions` → fetch submissions for the logged-in user
34/// - `GET /me/events` → fetch events for the logged-in user
35///
36/// All routes operate on the currently authenticated user and require the application state.
37pub fn me_routes() -> Router<AppState> {
38 Router::new()
39 .route("/announcements", get(announcements::get_my_announcements))
40 .route("/tickets", get(tickets::get_my_tickets))
41 .route("/assignments", get(assignments::get_my_assignments))
42 .route("/grades", get(grades::get_my_grades))
43 .route("/submissions", get(submissions::get_my_submissions))
44 .route("/events", get(events::get_my_events))
45}