Add connected controllers hashmap for controller-ws

This commit is contained in:
Tobias Reisinger 2023-11-28 20:20:12 +01:00
parent 6459804e1f
commit 6536ff0792
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
17 changed files with 267 additions and 649 deletions
emgauwa-lib/src/handlers/v1

View file

@ -104,16 +104,10 @@ pub async fn add_list(
let mut pool_conn = pool.acquire().await?;
let mut db_schedules: Vec<DbSchedule> = Vec::new();
data.iter().try_for_each(|s| {
let new_s = futures::executor::block_on(add_list_single(&mut pool_conn, s));
match new_s {
Ok(new_s) => {
db_schedules.push(new_s);
Ok(())
}
Err(e) => Err(e),
}
})?;
for s in data.iter() {
let new_s = futures::executor::block_on(add_list_single(&mut pool_conn, s))?;
db_schedules.push(new_s);
}
let schedules: Vec<Schedule> = convert_db_list(&mut pool_conn, db_schedules)?;
Ok(HttpResponse::Created().json(schedules))