better scoping and such

This commit is contained in:
Zynh0722 2023-11-06 11:15:51 -08:00
parent cecd4e0104
commit b6a0df5841

View file

@ -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)
} }