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:
parent
a9eef2b68f
commit
da718cf238
1 changed files with 6 additions and 6 deletions
12
src/main.rs
12
src/main.rs
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue