better scoping and such
This commit is contained in:
parent
cecd4e0104
commit
b6a0df5841
1 changed files with 10 additions and 8 deletions
|
@ -16,15 +16,17 @@ async fn home() -> impl IntoResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn dancers(State(state): State<AppState>) -> impl IntoResponse {
|
async fn dancers(State(state): State<AppState>) -> impl IntoResponse {
|
||||||
use cm_lib::schema::dancers::dsl::*;
|
let dancers = {
|
||||||
|
use cm_lib::schema::dancers::dsl::*;
|
||||||
|
|
||||||
let mut conn = state.connection.get().await.unwrap();
|
let mut conn = state.connection.get().await.unwrap();
|
||||||
|
|
||||||
let dancers_vec = dancers
|
dancers
|
||||||
.select(Dancer::as_select())
|
.select(Dancer::as_select())
|
||||||
.load(&mut conn)
|
.load(&mut conn)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
render!(crate::templates::dancers_html, dancers_vec)
|
render!(crate::templates::dancers_html, dancers)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue