rowt/src/tera/stat.rs

20 lines
428 B
Rust
Raw Normal View History

2023-07-24 20:56:46 +02:00
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 {}