Add notifier to break relay loop
This commit is contained in:
parent
83c1f033d5
commit
8785186dfa
12 changed files with 124 additions and 45 deletions
emgauwa-core/src/handlers/v1
|
@ -41,7 +41,7 @@ pub async fn show(
|
|||
#[put("/api/v1/controllers/{controller_id}")]
|
||||
pub async fn update(
|
||||
pool: web::Data<Pool<Sqlite>>,
|
||||
app_server: web::Data<Addr<AppState>>,
|
||||
app_state: web::Data<Addr<AppState>>,
|
||||
path: web::Path<(String,)>,
|
||||
data: web::Json<RequestUpdateController>,
|
||||
) -> Result<HttpResponse, EmgauwaError> {
|
||||
|
@ -60,7 +60,7 @@ pub async fn update(
|
|||
|
||||
let return_controller = Controller::from_db_model(&mut pool_conn, controller)?;
|
||||
|
||||
app_server
|
||||
app_state
|
||||
.send(app_state::Action {
|
||||
controller_uid: uid.clone(),
|
||||
action: ControllerWsAction::Controller(return_controller.clone()),
|
||||
|
@ -73,7 +73,7 @@ pub async fn update(
|
|||
#[delete("/api/v1/controllers/{controller_id}")]
|
||||
pub async fn delete(
|
||||
pool: web::Data<Pool<Sqlite>>,
|
||||
app_server: web::Data<Addr<AppState>>,
|
||||
app_state: web::Data<Addr<AppState>>,
|
||||
path: web::Path<(String,)>,
|
||||
) -> Result<HttpResponse, EmgauwaError> {
|
||||
let mut pool_conn = pool.acquire().await?;
|
||||
|
@ -81,7 +81,7 @@ pub async fn delete(
|
|||
let (controller_uid,) = path.into_inner();
|
||||
let uid = ControllerUid::try_from(controller_uid.as_str())?;
|
||||
|
||||
app_server
|
||||
app_state
|
||||
.send(app_state::DisconnectController {
|
||||
controller_uid: uid.clone(),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue