use rocket::{get, routes, Route, State}; use sqlx::SqlitePool; use crate::{ model::{log::Log, user::AdminUser}, tera::Config, }; pub mod boat; pub mod planned_event; pub mod user; #[get("/rss?")] async fn rss(db: &State, key: &str, config: &State) -> String { if key.eq(&config.rss_key) { Log::generate_feed(db).await } else { "Not allowed".into() } } #[get("/rss", rank = 2)] async fn show_rss(db: &State, _admin: AdminUser) -> String { Log::show(db).await } pub fn routes() -> Vec { let mut ret = Vec::new(); ret.append(&mut user::routes()); ret.append(&mut boat::routes()); ret.append(&mut planned_event::routes()); ret.append(&mut routes![rss, show_rss]); ret }