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
This commit is contained in:
Zynh0722 2023-11-06 20:41:53 -08:00
parent a9eef2b68f
commit da718cf238

View file

@ -143,13 +143,13 @@ async fn shift_report(State(state): State<AppState>, Path(id): Path<u32>) -> imp
}
async fn shift_reports(State(state): State<AppState>) -> impl IntoResponse {
let mut conn = state.connection.get().await.unwrap();
let mut shifts: Vec<Shift> = {
use cm_lib::schema::shifts::dsl::*;
let mut shifts: Vec<Shift> = 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));