use rocket::{get, routes, Route, State}; use rocket_dyn_templates::{context, Template}; use sqlx::SqlitePool; use crate::model::{ stat::{self, Stat}, user::User, }; #[get("/")] async fn index(db: &State, user: User) -> Template { let stat = Stat::get_rowed_km(db).await; let personal = stat::get_personal(db, &user).await; Template::render("stat", context!(loggedin_user: &user, stat, personal)) } pub fn routes() -> Vec { routes![index] } #[cfg(test)] mod test {}