Add WIP relays to database and api
This commit is contained in:
parent
4e3df272c3
commit
734f8b291c
14 changed files with 387 additions and 88 deletions
emgauwa-lib/src/db
|
@ -1,12 +1,11 @@
|
|||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_derive::Serialize;
|
||||
use std::ops::DerefMut;
|
||||
|
||||
use sqlx::pool::PoolConnection;
|
||||
use sqlx::Sqlite;
|
||||
|
||||
use crate::db::errors::DatabaseError;
|
||||
use crate::db::model_utils::Period;
|
||||
use crate::db::tag::Tag;
|
||||
use crate::db::Tag;
|
||||
use crate::db::types::ControllerUid;
|
||||
|
||||
#[derive(Debug, Serialize, Clone)]
|
||||
|
@ -18,9 +17,6 @@ pub struct Controller {
|
|||
pub active: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
pub struct Periods(pub Vec<Period>);
|
||||
|
||||
impl Controller {
|
||||
pub async fn get_all(
|
||||
conn: &mut PoolConnection<Sqlite>,
|
||||
|
@ -117,6 +113,6 @@ impl Controller {
|
|||
.execute(conn.deref_mut())
|
||||
.await?;
|
||||
|
||||
Controller::get_by_uid(conn, &self.uid).await
|
||||
Self::get(conn, self.id).await
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue