2023-05-24 15:36:38 +02:00
|
|
|
use rocket::{get, routes, Route, State};
|
|
|
|
use sqlx::SqlitePool;
|
|
|
|
|
|
|
|
use crate::model::log::Log;
|
2023-04-04 10:44:14 +02:00
|
|
|
|
2023-04-04 12:19:56 +02:00
|
|
|
pub mod planned_event;
|
2023-04-04 10:44:14 +02:00
|
|
|
pub mod user;
|
|
|
|
|
2023-05-24 15:36:38 +02:00
|
|
|
#[get("/rss?<key>")]
|
|
|
|
async fn rss(db: &State<SqlitePool>, key: Option<&str>) -> String {
|
|
|
|
match key {
|
|
|
|
Some(key) if key.eq("G9h/f2MFEr408IaB4Yd67/maVSsnAJNjcaZ2Tzl5Vo=") => {
|
|
|
|
Log::generate_feed(db).await
|
|
|
|
}
|
|
|
|
_ => "Not allowed".to_string(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-04 10:44:14 +02:00
|
|
|
pub fn routes() -> Vec<Route> {
|
|
|
|
let mut ret = Vec::new();
|
|
|
|
ret.append(&mut user::routes());
|
2023-04-04 12:19:56 +02:00
|
|
|
ret.append(&mut planned_event::routes());
|
2023-05-24 15:36:38 +02:00
|
|
|
ret.append(&mut routes![rss]);
|
2023-04-04 10:44:14 +02:00
|
|
|
ret
|
|
|
|
}
|