add initial crates and apps
This commit is contained in:
parent
5c87ba3519
commit
1ca300098f
113 changed files with 28169 additions and 0 deletions
57
crates/chattyness-user-ui/src/api/routes.rs
Normal file
57
crates/chattyness-user-ui/src/api/routes.rs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
//! API routes for user UI.
|
||||
//!
|
||||
//! This router provides READ-ONLY access to realms, scenes, and spots.
|
||||
//! All create/update/delete operations are handled by the admin-ui.
|
||||
//! Channel presence is handled via WebSocket.
|
||||
|
||||
use axum::{routing::get, Router};
|
||||
|
||||
use super::{auth, avatars, realms, scenes, websocket};
|
||||
use crate::app::AppState;
|
||||
|
||||
/// Build the API router for user UI.
|
||||
///
|
||||
/// Note: This router is READ-ONLY for realms/scenes/spots.
|
||||
/// Auth routes (login, logout, signup, join-realm) are allowed.
|
||||
/// Channel presence (join, leave, position, emotion, members) is handled via WebSocket.
|
||||
pub fn api_router() -> Router<AppState> {
|
||||
Router::new()
|
||||
// Auth routes (these are user-facing operations)
|
||||
.route("/auth/me", get(auth::get_current_user))
|
||||
.route("/auth/login", axum::routing::post(auth::login))
|
||||
.route("/auth/logout", axum::routing::post(auth::logout))
|
||||
.route("/auth/signup", axum::routing::post(auth::signup))
|
||||
.route("/auth/guest", axum::routing::post(auth::guest_login))
|
||||
.route("/auth/join-realm", axum::routing::post(auth::join_realm))
|
||||
.route(
|
||||
"/auth/reset-password",
|
||||
axum::routing::post(auth::reset_password),
|
||||
)
|
||||
// Realm routes (READ-ONLY)
|
||||
.route("/realms", get(realms::list_realms))
|
||||
.route("/realms/{slug}", get(realms::get_realm))
|
||||
.route("/realms/{slug}/available", get(realms::check_slug_available))
|
||||
// Scene routes (READ-ONLY)
|
||||
.route("/realms/{slug}/entry-scene", get(scenes::get_entry_scene))
|
||||
.route("/realms/{slug}/scenes", get(scenes::list_scenes))
|
||||
.route("/realms/{slug}/scenes/{scene_slug}", get(scenes::get_scene))
|
||||
// Spot routes (READ-ONLY)
|
||||
.route(
|
||||
"/realms/{slug}/scenes/{scene_slug}/spots",
|
||||
get(scenes::list_spots),
|
||||
)
|
||||
.route(
|
||||
"/realms/{slug}/scenes/{scene_slug}/spots/{spot_id}",
|
||||
get(scenes::get_spot),
|
||||
)
|
||||
// WebSocket route for channel presence (handles join, leave, position, emotion, members)
|
||||
.route(
|
||||
"/realms/{slug}/channels/{channel_id}/ws",
|
||||
get(websocket::ws_handler::<AppState>),
|
||||
)
|
||||
// Avatar routes (require authentication)
|
||||
.route(
|
||||
"/realms/{slug}/avatar/current",
|
||||
get(avatars::get_current_avatar),
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue