Add filter by controller uid in macro execute
This commit is contained in:
parent
02c613e0fd
commit
8616c70f21
1 changed files with 7 additions and 4 deletions
|
@ -1,13 +1,14 @@
|
||||||
use actix::Addr;
|
use actix::Addr;
|
||||||
use actix_web::{delete, get, post, put, web, HttpResponse};
|
use actix_web::{delete, get, HttpResponse, post, put, web};
|
||||||
|
use itertools::Itertools;
|
||||||
|
use sqlx::{Pool, Sqlite};
|
||||||
|
|
||||||
use emgauwa_common::db::DbMacro;
|
use emgauwa_common::db::DbMacro;
|
||||||
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
|
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
|
||||||
use emgauwa_common::models::{convert_db_list, FromDbModel, Macro, MacroAction, Relay};
|
use emgauwa_common::models::{convert_db_list, FromDbModel, Macro, MacroAction, Relay};
|
||||||
use emgauwa_common::types::{
|
use emgauwa_common::types::{
|
||||||
ControllerWsAction, EmgauwaUid, RequestMacroCreate, RequestMacroExecute, RequestMacroUpdate,
|
ControllerWsAction, EmgauwaUid, RequestMacroCreate, RequestMacroExecute, RequestMacroUpdate,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
|
||||||
use sqlx::{Pool, Sqlite};
|
|
||||||
|
|
||||||
use crate::app_state;
|
use crate::app_state;
|
||||||
use crate::app_state::AppState;
|
use crate::app_state::AppState;
|
||||||
|
@ -141,7 +142,9 @@ pub async fn execute(
|
||||||
let mut affected_relay_ids: Vec<i64> = Vec::new();
|
let mut affected_relay_ids: Vec<i64> = Vec::new();
|
||||||
|
|
||||||
for action in actions.iter_mut() {
|
for action in actions.iter_mut() {
|
||||||
if affected_relay_ids.contains(&action.relay.r.id) {
|
if affected_relay_ids.contains(&action.relay.r.id)
|
||||||
|
|| action.relay.controller_id != controller_uid
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
action.relay.reload(&mut pool_conn)?;
|
action.relay.reload(&mut pool_conn)?;
|
||||||
|
|
Loading…
Reference in a new issue