Add fmt options and move handlers

This commit is contained in:
Tobias Reisinger 2023-11-29 14:27:46 +01:00
parent 50bcac2a1b
commit fdca5b7277
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
28 changed files with 85 additions and 70 deletions

View file

@ -1,10 +1,11 @@
use std::str::FromStr;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use sqlx::database::HasArguments;
use sqlx::encode::IsNull;
use sqlx::error::BoxDynError;
use sqlx::sqlite::{SqliteTypeInfo, SqliteValueRef};
use sqlx::{Decode, Encode, Sqlite, Type};
use std::str::FromStr;
use uuid::Uuid;
#[derive(Clone, Debug, Eq, PartialEq, Hash)]

View file

@ -1,12 +1,18 @@
mod controller_uid;
mod schedule_uid;
use crate::models::Controller;
pub use controller_uid::ControllerUid;
pub use schedule_uid::ScheduleUid;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
pub use controller_uid::ControllerUid;
pub use schedule_uid::ScheduleUid;
use serde_derive::{Deserialize, Serialize};
use crate::models::Controller;
pub type ConnectedControllersType = Arc<Mutex<HashMap<ControllerUid, Controller>>>;
#[derive(Debug, Serialize, Deserialize)]
pub enum ControllerWsAction {
Register(Controller),
}

View file

@ -19,11 +19,11 @@ pub enum ScheduleUid {
impl ScheduleUid {
const OFF_STR: &'static str = "off";
const ON_STR: &'static str = "on";
const OFF_U8: u8 = 0;
const ON_U8: u8 = 1;
const OFF_U128: u128 = 0;
const OFF_U8: u8 = 0;
const ON_STR: &'static str = "on";
const ON_U128: u128 = 1;
const ON_U8: u8 = 1;
}
impl Default for ScheduleUid {