Rename emgauwa-lib to emgauwa-common

This commit is contained in:
Tobias Reisinger 2024-04-30 08:44:33 +02:00
parent 6340cfd5c7
commit 9bc75b9627
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
58 changed files with 135 additions and 100 deletions

View file

@ -5,7 +5,7 @@ edition = "2021"
authors = ["Tobias Reisinger <tobias@msrg.cc>"]
[dependencies]
emgauwa-lib = { path = "../emgauwa-lib" }
emgauwa-common = { path = "../emgauwa-common" }
actix = "0.13"
actix-web = "4.4"

View file

@ -1,10 +1,10 @@
use std::collections::HashMap;
use actix::{Actor, Addr, Context, Handler, Message, Recipient};
use emgauwa_lib::db::DbController;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::{convert_db_list, Controller, Relay};
use emgauwa_lib::types::{ControllerWsAction, EmgauwaUid, RelayStates};
use emgauwa_common::db::DbController;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::models::{convert_db_list, Controller, Relay};
use emgauwa_common::types::{ControllerWsAction, EmgauwaUid, RelayStates};
use futures::executor::block_on;
use sqlx::{Pool, Sqlite};

View file

@ -1,9 +1,9 @@
use actix::Addr;
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::{ControllerWsAction, EmgauwaUid, RequestControllerUpdate};
use emgauwa_common::db::DbController;
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
use emgauwa_common::models::{convert_db_list, Controller, FromDbModel};
use emgauwa_common::types::{ControllerWsAction, EmgauwaUid, RequestControllerUpdate};
use sqlx::{Pool, Sqlite};
use crate::app_state;

View file

@ -1,9 +1,9 @@
use actix::Addr;
use actix_web::{delete, get, post, put, web, HttpResponse};
use emgauwa_lib::db::DbMacro;
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
use emgauwa_lib::models::{convert_db_list, FromDbModel, Macro, MacroAction, Relay};
use emgauwa_lib::types::{
use emgauwa_common::db::DbMacro;
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
use emgauwa_common::models::{convert_db_list, FromDbModel, Macro, MacroAction, Relay};
use emgauwa_common::types::{
ControllerWsAction, EmgauwaUid, RequestMacroCreate, RequestMacroExecute, RequestMacroUpdate,
};
use itertools::Itertools;

View file

@ -1,10 +1,12 @@
use actix::Addr;
use actix_web::{get, post, put, web, HttpResponse};
use emgauwa_lib::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbTag};
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
use emgauwa_lib::models::{convert_db_list, FromDbModel, Relay};
use emgauwa_lib::types::{ControllerWsAction, EmgauwaUid, RequestRelayPulse, RequestRelayUpdate};
use emgauwa_lib::utils;
use emgauwa_common::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbTag};
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
use emgauwa_common::models::{convert_db_list, FromDbModel, Relay};
use emgauwa_common::types::{
ControllerWsAction, EmgauwaUid, RequestRelayPulse, RequestRelayUpdate,
};
use emgauwa_common::utils;
use sqlx::{Pool, Sqlite};
use crate::app_state;

View file

@ -1,9 +1,9 @@
use actix::Addr;
use actix_web::{delete, get, post, put, web, HttpResponse};
use emgauwa_lib::db::{DbController, DbJunctionRelaySchedule, DbSchedule, DbTag};
use emgauwa_lib::errors::{ApiError, DatabaseError, EmgauwaError};
use emgauwa_lib::models::{convert_db_list, FromDbModel, Schedule};
use emgauwa_lib::types::{
use emgauwa_common::db::{DbController, DbJunctionRelaySchedule, DbSchedule, DbTag};
use emgauwa_common::errors::{ApiError, DatabaseError, EmgauwaError};
use emgauwa_common::models::{convert_db_list, FromDbModel, Schedule};
use emgauwa_common::types::{
ControllerWsAction, RequestScheduleCreate, RequestScheduleUpdate, ScheduleUid,
};
use itertools::Itertools;

View file

@ -1,8 +1,8 @@
use actix_web::{delete, get, post, web, HttpResponse};
use emgauwa_lib::db::DbTag;
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
use emgauwa_lib::models::{FromDbModel, Tag};
use emgauwa_lib::types::RequestTagCreate;
use emgauwa_common::db::DbTag;
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
use emgauwa_common::models::{FromDbModel, Tag};
use emgauwa_common::types::RequestTagCreate;
use sqlx::{Pool, Sqlite};
#[get("/tags")]

View file

@ -1,9 +1,9 @@
use actix::{Actor, AsyncContext};
use emgauwa_lib::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbSchedule};
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
use emgauwa_lib::models::{Controller, FromDbModel};
use emgauwa_lib::types::{ControllerWsAction, EmgauwaUid, RelayStates};
use emgauwa_lib::utils;
use emgauwa_common::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbSchedule};
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
use emgauwa_common::models::{Controller, FromDbModel};
use emgauwa_common::types::{ControllerWsAction, EmgauwaUid, RelayStates};
use emgauwa_common::utils;
use futures::executor::block_on;
use sqlx::pool::PoolConnection;
use sqlx::Sqlite;

View file

@ -5,9 +5,9 @@ use std::time::Instant;
use actix::{Actor, ActorContext, Addr, AsyncContext, Handler, StreamHandler};
use actix_web_actors::ws;
use actix_web_actors::ws::ProtocolError;
use emgauwa_lib::constants::{HEARTBEAT_INTERVAL, HEARTBEAT_TIMEOUT};
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::types::{ControllerWsAction, EmgauwaUid};
use emgauwa_common::constants::{HEARTBEAT_INTERVAL, HEARTBEAT_TIMEOUT};
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::types::{ControllerWsAction, EmgauwaUid};
use futures::executor::block_on;
use sqlx::pool::PoolConnection;
use sqlx::{Pool, Sqlite};

View file

@ -3,7 +3,7 @@ use std::time::Instant;
use actix::Addr;
use actix_web::{get, web, HttpRequest, HttpResponse};
use actix_web_actors::ws;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_common::errors::EmgauwaError;
use sqlx::{Pool, Sqlite};
use crate::app_state::AppState;

View file

@ -3,8 +3,8 @@ use std::time::Instant;
use actix::{Actor, ActorContext, Addr, AsyncContext, Handler, Message, StreamHandler};
use actix_web_actors::ws;
use actix_web_actors::ws::ProtocolError;
use emgauwa_lib::constants::{HEARTBEAT_INTERVAL, HEARTBEAT_TIMEOUT};
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_common::constants::{HEARTBEAT_INTERVAL, HEARTBEAT_TIMEOUT};
use emgauwa_common::errors::EmgauwaError;
use futures::executor::block_on;
use crate::app_state::{AppState, ConnectRelayClient};

View file

@ -4,9 +4,9 @@ use actix::{Actor, Arbiter};
use actix_cors::Cors;
use actix_web::middleware::TrailingSlash;
use actix_web::{middleware, web, App, HttpServer};
use emgauwa_lib::db::DbController;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::utils::{drop_privileges, init_logging};
use emgauwa_common::db::DbController;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::utils::{drop_privileges, init_logging};
use serde_json::json;
use utoipa_swagger_ui::SwaggerUi;
@ -26,7 +26,7 @@ async fn main() -> Result<(), std::io::Error> {
init_logging(&settings.logging.level)?;
let pool = emgauwa_lib::db::init(&settings.database).await?;
let pool = emgauwa_common::db::init(&settings.database).await?;
let mut conn = pool.acquire().await.map_err(EmgauwaError::from)?;
DbController::all_inactive(&mut conn)

View file

@ -1,5 +1,5 @@
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::settings;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::settings;
use serde_derive::Deserialize;
#[derive(Clone, Debug, Deserialize)]