26 lines
644 B
Rust
26 lines
644 B
Rust
use rocket::{get, routes, Route, State};
|
|
use sqlx::SqlitePool;
|
|
|
|
use crate::{model::log::Log, tera::Config};
|
|
|
|
pub mod boat;
|
|
pub mod planned_event;
|
|
pub mod user;
|
|
|
|
#[get("/rss?<key>")]
|
|
async fn rss(db: &State<SqlitePool>, key: Option<&str>, config: &State<Config>) -> String {
|
|
match key {
|
|
Some(key) if key.eq(&config.rss_key) => Log::generate_feed(db).await,
|
|
_ => "Not allowed".to_string(),
|
|
}
|
|
}
|
|
|
|
pub fn routes() -> Vec<Route> {
|
|
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]);
|
|
ret
|
|
}
|