Add connected controllers hashmap for controller-ws
This commit is contained in:
parent
6459804e1f
commit
6536ff0792
17 changed files with 267 additions and 649 deletions
emgauwa-lib/src/handlers/v1
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue