From da718cf2385bcc0a57fd586121fe13eaca7673f1 Mon Sep 17 00:00:00 2001 From: Zynh0722 Date: Mon, 6 Nov 2023 20:41:53 -0800 Subject: [PATCH] switch to using schema dsl for shift_reports why? when I know damned well that this function is getting dumpstered when I start working on this portion of the code? /shrug --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 632d704..5b21d7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -143,13 +143,13 @@ async fn shift_report(State(state): State, Path(id): Path) -> imp } async fn shift_reports(State(state): State) -> impl IntoResponse { - let mut conn = state.connection.get().await.unwrap(); + let mut shifts: Vec = { + use cm_lib::schema::shifts::dsl::*; - let mut shifts: Vec = shifts::table - .select(Shift::as_select()) - .load(&mut conn) - .await - .unwrap(); + let mut conn = state.connection.get().await.unwrap(); + + shifts.load(&mut conn).await.unwrap() + }; shifts.sort_by(|a, b| b.start.cmp(&a.start));