backend/src/api/v1/channels/mod.rs
Radical 8a58774359
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
ci/woodpecker/push/publish-docs Pipeline failed
fix: get cache correctly from redis
2025-07-20 20:25:15 +02:00

25 lines
711 B
Rust

use std::sync::Arc;
use axum::{
Router,
middleware::from_fn_with_state,
routing::{any, delete, get, patch},
};
//use socketioxide::SocketIo;
use crate::{AppState, api::v1::auth::CurrentUser};
mod uuid;
pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
let router_with_auth = Router::new()
.route("/{uuid}", get(uuid::get))
.route("/{uuid}", delete(uuid::delete))
.route("/{uuid}", patch(uuid::patch))
.route("/{uuid}/messages", get(uuid::messages::get))
.layer(from_fn_with_state(app_state, CurrentUser::check_auth_layer));
Router::new()
.route("/{uuid}/socket", any(uuid::socket::ws))
.merge(router_with_auth)
}