Rename ControllerUid to a more general EmgauwaUid (for macros)
This commit is contained in:
parent
07d3322c5a
commit
51aa0d3c99
11 changed files with 55 additions and 57 deletions
emgauwa-core/src/handlers/v1
|
@ -3,7 +3,7 @@ use actix_web::{delete, get, put, web, HttpResponse};
|
|||
use emgauwa_lib::db::DbController;
|
||||
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
|
||||
use emgauwa_lib::models::{convert_db_list, Controller, FromDbModel};
|
||||
use emgauwa_lib::types::{ControllerUid, ControllerWsAction, RequestControllerUpdate};
|
||||
use emgauwa_lib::types::{ControllerWsAction, EmgauwaUid, RequestControllerUpdate};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
use crate::app_state;
|
||||
|
@ -28,7 +28,7 @@ pub async fn show(
|
|||
let mut pool_conn = pool.acquire().await?;
|
||||
|
||||
let (controller_uid,) = path.into_inner();
|
||||
let uid = ControllerUid::try_from(controller_uid.as_str())?;
|
||||
let uid = EmgauwaUid::try_from(controller_uid.as_str())?;
|
||||
|
||||
let controller = DbController::get_by_uid(&mut pool_conn, &uid)
|
||||
.await?
|
||||
|
@ -40,15 +40,15 @@ pub async fn show(
|
|||
|
||||
#[put("/controllers/{controller_id}")]
|
||||
pub async fn update(
|
||||
pool: web::Data<Pool<Sqlite>>,
|
||||
app_state: web::Data<Addr<AppState>>,
|
||||
path: web::Path<(String,)>,
|
||||
data: web::Json<RequestControllerUpdate>,
|
||||
pool: web::Data<Pool<Sqlite>>,
|
||||
app_state: web::Data<Addr<AppState>>,
|
||||
path: web::Path<(String,)>,
|
||||
data: web::Json<RequestControllerUpdate>,
|
||||
) -> Result<HttpResponse, EmgauwaError> {
|
||||
let mut pool_conn = pool.acquire().await?;
|
||||
|
||||
let (controller_uid,) = path.into_inner();
|
||||
let uid = ControllerUid::try_from(controller_uid.as_str())?;
|
||||
let uid = EmgauwaUid::try_from(controller_uid.as_str())?;
|
||||
|
||||
let controller = DbController::get_by_uid(&mut pool_conn, &uid)
|
||||
.await?
|
||||
|
@ -79,7 +79,7 @@ pub async fn delete(
|
|||
let mut pool_conn = pool.acquire().await?;
|
||||
|
||||
let (controller_uid,) = path.into_inner();
|
||||
let uid = ControllerUid::try_from(controller_uid.as_str())?;
|
||||
let uid = EmgauwaUid::try_from(controller_uid.as_str())?;
|
||||
|
||||
app_state
|
||||
.send(app_state::DisconnectController {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue