From f4e6eb56c8c3c23607aa2e22326b471fb1beec4f Mon Sep 17 00:00:00 2001 From: GW_MC <72297530+GWMCwing@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:12:24 +0800 Subject: [PATCH] Update sea-orm dependencies to use workspace configuration; add dead code annotations in service error handling and settings service --- Cargo.toml | 5 +++++ apps/api/Cargo.toml | 2 +- apps/api/src/errors/service_error.rs | 1 + apps/api/src/routes.rs | 3 ++- apps/api/src/services/settings.rs | 3 +++ public/database/Cargo.toml | 2 +- public/migration/Cargo.toml | 4 ++-- 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e969cee..9c3e719 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,8 @@ resolver = "3" [workspace.lints.clippy] module_inception = "allow" + +[workspace.dependencies] +sea-orm = "2.0.0-rc" +sea-orm-cli = "2.0.0-rc" +sea-orm-migration = "2.0.0-rc" diff --git a/apps/api/Cargo.toml b/apps/api/Cargo.toml index 87132f3..d5c120c 100644 --- a/apps/api/Cargo.toml +++ b/apps/api/Cargo.toml @@ -17,4 +17,4 @@ tracing = { version = "0.1.41", features = ["std", "attributes"] } tracing-subscriber = { version = "0.3.20", features = ["smallvec", "fmt", "ansi", "tracing-log", "std", "chrono", "json", "serde", "serde_json", "time", "tracing"] } serde_json = { version = "1.0.145", features = ["std"] } serde = { version = "1.0.228", features = ["std", "derive"] } -sea-orm = { version = "2.0.0-rc" } +sea-orm = { workspace = true } diff --git a/apps/api/src/errors/service_error.rs b/apps/api/src/errors/service_error.rs index ce8c3f8..20a5835 100644 --- a/apps/api/src/errors/service_error.rs +++ b/apps/api/src/errors/service_error.rs @@ -1,5 +1,6 @@ pub type ServiceError = Box; +#[allow(dead_code)] // TODO: remove when used pub trait IntoServiceError { fn into_service_error(self) -> ServiceError; } diff --git a/apps/api/src/routes.rs b/apps/api/src/routes.rs index ddb1b51..c0d22db 100644 --- a/apps/api/src/routes.rs +++ b/apps/api/src/routes.rs @@ -15,9 +15,10 @@ pub struct AppState { pub service: Arc, } -pub type ServiceState = Arc; +pub type ServiceState = Arc; pub struct AppService { + #[allow(dead_code)] // TODO: remove when used pub settings: ServiceState, } diff --git a/apps/api/src/services/settings.rs b/apps/api/src/services/settings.rs index c778427..847db61 100644 --- a/apps/api/src/services/settings.rs +++ b/apps/api/src/services/settings.rs @@ -11,11 +11,14 @@ use crate::errors::service_error::{IntoServiceError, ServiceError}; #[async_trait::async_trait] pub trait SettingsStore: Send + Sync { + #[allow(dead_code)] // TODO: remove when used async fn get_setting(&self, key: &str) -> Result; + #[allow(dead_code)] // TODO: remove when used async fn set_setting(&self, key: &str, value: String) -> Result<(), ServiceError>; } pub struct SettingsService { + #[allow(dead_code)] // TODO: remove when used connection: Arc, } diff --git a/public/database/Cargo.toml b/public/database/Cargo.toml index c180e41..76064c9 100644 --- a/public/database/Cargo.toml +++ b/public/database/Cargo.toml @@ -13,7 +13,7 @@ chrono = { version = "0.4", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tokio = { version = "1.47.0", features = ["full"] } -sea-orm = { version = "2.0.0-rc", features = [ "sqlx-postgres", "sqlx-mysql", "sqlx-sqlite", "runtime-tokio-rustls", "macros", "mock", "with-chrono", "with-json", "with-uuid", "sqlite-use-returning-for-3_35", "mariadb-use-returning" ] } +sea-orm = { workspace = true, features = [ "sqlx-postgres", "sqlx-mysql", "sqlx-sqlite", "runtime-tokio-rustls", "macros", "mock", "with-chrono", "with-json", "with-uuid", "sqlite-use-returning-for-3_35", "mariadb-use-returning" ] } log = "0.4.28" [lints] diff --git a/public/migration/Cargo.toml b/public/migration/Cargo.toml index fa42db8..ed761e5 100644 --- a/public/migration/Cargo.toml +++ b/public/migration/Cargo.toml @@ -11,11 +11,11 @@ path = "src/lib.rs" [dependencies] tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread"] } -sea-orm-cli = { version = "2.0.0-rc", features = ["sqlx-postgres", "sqlx-mysql", "sqlx-sqlite", "runtime-tokio"] } +sea-orm-cli = { workspace = true, features = ["sqlx-postgres", "sqlx-mysql", "sqlx-sqlite", "runtime-tokio"] } log = "0.4.28" [dependencies.sea-orm-migration] -version = "2.0.0-rc" +workspace = true features = [ "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature "sqlx-postgres", "sqlx-mysql", "sqlx-sqlite" # `DATABASE_DRIVER` features