Add fmt options and move handlers
This commit is contained in:
parent
50bcac2a1b
commit
fdca5b7277
28 changed files with 85 additions and 70 deletions
|
@ -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)]
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue