rowt/src/tera/stat.rs
2023-07-24 20:56:46 +02:00

20 lines
428 B
Rust

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