From 452454f9e82485dbc92ca1e9e801dc14cfdb330a Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 23 Nov 2023 13:39:18 +0100 Subject: [PATCH] Flatten import for db-Schedule --- emgauwa-lib/src/db/mod.rs | 4 +++- emgauwa-lib/src/db/model_utils.rs | 2 +- emgauwa-lib/src/db/tag.rs | 2 +- emgauwa-lib/src/handlers/v1/schedules.rs | 2 +- emgauwa-lib/src/handlers/v1/ws/controllers.rs | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/emgauwa-lib/src/db/mod.rs b/emgauwa-lib/src/db/mod.rs index efef1fa..a870673 100644 --- a/emgauwa-lib/src/db/mod.rs +++ b/emgauwa-lib/src/db/mod.rs @@ -6,9 +6,11 @@ use std::str::FromStr; use crate::db::errors::DatabaseError; use crate::db::model_utils::Period; -use crate::db::schedules::{Periods, Schedule}; use crate::db::types::EmgauwaUid; +// export for easier/flatter access +pub use crate::db::schedules::{Periods, Schedule}; + pub(crate) mod errors; mod model_utils; mod models; diff --git a/emgauwa-lib/src/db/model_utils.rs b/emgauwa-lib/src/db/model_utils.rs index 565a7d2..c455483 100644 --- a/emgauwa-lib/src/db/model_utils.rs +++ b/emgauwa-lib/src/db/model_utils.rs @@ -1,4 +1,4 @@ -use crate::db::schedules::Periods; +use crate::db::Periods; use chrono::{NaiveTime, Timelike}; use serde::{Deserialize, Serialize}; use sqlx::database::HasArguments; diff --git a/emgauwa-lib/src/db/tag.rs b/emgauwa-lib/src/db/tag.rs index 2f10318..82819f0 100644 --- a/emgauwa-lib/src/db/tag.rs +++ b/emgauwa-lib/src/db/tag.rs @@ -6,7 +6,7 @@ use sqlx::Sqlite; use crate::db::errors::DatabaseError; use crate::db::models::*; -use crate::db::schedules::Schedule; +use crate::db::Schedule; #[derive(Debug, Serialize, Clone)] pub struct Tag { diff --git a/emgauwa-lib/src/handlers/v1/schedules.rs b/emgauwa-lib/src/handlers/v1/schedules.rs index c615c3a..5c62a59 100644 --- a/emgauwa-lib/src/handlers/v1/schedules.rs +++ b/emgauwa-lib/src/handlers/v1/schedules.rs @@ -4,7 +4,7 @@ use sqlx::pool::PoolConnection; use sqlx::{Pool, Sqlite}; use crate::db::errors::DatabaseError; -use crate::db::schedules::*; +use crate::db::{Periods, Schedule}; use crate::db::tag::Tag; use crate::db::types::EmgauwaUid; use crate::handlers::errors::ApiError; diff --git a/emgauwa-lib/src/handlers/v1/ws/controllers.rs b/emgauwa-lib/src/handlers/v1/ws/controllers.rs index 9766045..b368b7c 100644 --- a/emgauwa-lib/src/handlers/v1/ws/controllers.rs +++ b/emgauwa-lib/src/handlers/v1/ws/controllers.rs @@ -1,4 +1,4 @@ -use crate::db::schedules::Schedule; +use crate::db::Schedule; use crate::handlers::errors::ApiError; use actix::{Actor, StreamHandler}; use actix_web::{get, web, HttpRequest, HttpResponse};