This commit is contained in:
Stefan Schwarz 2020-08-15 09:10:47 +02:00
parent 7100621f5e
commit 09a3f096c7
8 changed files with 154 additions and 115 deletions

18
src/routes.rs Normal file
View file

@ -0,0 +1,18 @@
use crate::db;
use crate::templates;
pub async fn healthz(_request: crate::Request) -> tide::Result {
Ok("ok".into())
}
pub async fn index(request: crate::Request) -> tide::Result {
let my = db::Entry::for_user("foosinn")
.fetch_all(&request.state().pool)
.await
.map_err(|err| dbg!(err))?;
let unassinged = db::AliveDevice::unassinged()
.fetch_all(&request.state().pool)
.await
.map_err(|err| dbg!(err))?;
Ok(templates::IndexTemplate::new(my, unassinged).into())
}