Add log-init-function and websocket retry
This commit is contained in:
parent
6536ff0792
commit
50bcac2a1b
12 changed files with 73 additions and 69 deletions
emgauwa-lib/src/handlers/v1
|
@ -9,18 +9,12 @@ use crate::models::{convert_db_list, Controller};
|
|||
use crate::types::ConnectedControllersType;
|
||||
|
||||
#[get("/api/v1/controllers")]
|
||||
pub async fn index(
|
||||
pool: web::Data<Pool<Sqlite>>,
|
||||
connected_controllers: web::Data<ConnectedControllersType>,
|
||||
) -> Result<HttpResponse, ApiError> {
|
||||
pub async fn index(pool: web::Data<Pool<Sqlite>>) -> Result<HttpResponse, ApiError> {
|
||||
let mut pool_conn = pool.acquire().await?;
|
||||
|
||||
let db_controllers = DbController::get_all(&mut pool_conn).await?;
|
||||
|
||||
let controllers: Vec<Controller> = convert_db_list(&mut pool_conn, db_controllers)?;
|
||||
|
||||
let data = connected_controllers.lock().unwrap();
|
||||
println!("{:?}", *data);
|
||||
|
||||
Ok(HttpResponse::Ok().json(controllers))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue