Refactor more stuff
This commit is contained in:
parent
5a7b2de0ea
commit
9394a1ae52
15 changed files with 167 additions and 86 deletions
emgauwa-core/src/handlers/v1
|
@ -1,11 +1,15 @@
|
|||
use actix::Addr;
|
||||
use actix_web::{get, put, web, HttpResponse};
|
||||
use emgauwa_lib::db::{DbController, DbRelay, DbTag};
|
||||
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
|
||||
use emgauwa_lib::models::{convert_db_list, FromDbModel, Relay};
|
||||
use emgauwa_lib::types::ControllerUid;
|
||||
use emgauwa_lib::types::{ControllerUid, ControllerWsAction};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
use crate::app_state;
|
||||
use crate::app_state::AppServer;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct RequestRelay {
|
||||
name: String,
|
||||
|
@ -64,6 +68,7 @@ pub async fn index_for_controller(
|
|||
#[get("/api/v1/controllers/{controller_id}/relays/{relay_num}")]
|
||||
pub async fn show_for_controller(
|
||||
pool: web::Data<Pool<Sqlite>>,
|
||||
app_server: web::Data<Addr<AppServer>>,
|
||||
path: web::Path<(String, i64)>,
|
||||
) -> Result<HttpResponse, EmgauwaError> {
|
||||
let mut pool_conn = pool.acquire().await?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue