feature/api-setup #4

Merged
GW_MC merged 11 commits from feature/api-setup into master 2025-12-02 17:25:47 +08:00
7 changed files with 15 additions and 5 deletions
Showing only changes of commit f4e6eb56c8 - Show all commits

View File

@@ -12,3 +12,8 @@ resolver = "3"
[workspace.lints.clippy] [workspace.lints.clippy]
module_inception = "allow" 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"

View File

@@ -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"] } 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_json = { version = "1.0.145", features = ["std"] }
serde = { version = "1.0.228", features = ["std", "derive"] } serde = { version = "1.0.228", features = ["std", "derive"] }
sea-orm = { version = "2.0.0-rc" } sea-orm = { workspace = true }

View File

@@ -1,5 +1,6 @@
pub type ServiceError = Box<dyn std::error::Error + Send + Sync>; pub type ServiceError = Box<dyn std::error::Error + Send + Sync>;
#[allow(dead_code)] // TODO: remove when used
pub trait IntoServiceError { pub trait IntoServiceError {
fn into_service_error(self) -> ServiceError; fn into_service_error(self) -> ServiceError;
} }

View File

@@ -15,9 +15,10 @@ pub struct AppState {
pub service: Arc<AppService>, pub service: Arc<AppService>,
} }
pub type ServiceState<T: ?Sized + Send + Sync> = Arc<T>; pub type ServiceState<T> = Arc<T>;
pub struct AppService { pub struct AppService {
#[allow(dead_code)] // TODO: remove when used
pub settings: ServiceState<dyn SettingsStore>, pub settings: ServiceState<dyn SettingsStore>,
} }

View File

@@ -11,11 +11,14 @@ use crate::errors::service_error::{IntoServiceError, ServiceError};
#[async_trait::async_trait] #[async_trait::async_trait]
pub trait SettingsStore: Send + Sync { pub trait SettingsStore: Send + Sync {
#[allow(dead_code)] // TODO: remove when used
async fn get_setting(&self, key: &str) -> Result<String, ServiceError>; async fn get_setting(&self, key: &str) -> Result<String, ServiceError>;
#[allow(dead_code)] // TODO: remove when used
async fn set_setting(&self, key: &str, value: String) -> Result<(), ServiceError>; async fn set_setting(&self, key: &str, value: String) -> Result<(), ServiceError>;
} }
pub struct SettingsService { pub struct SettingsService {
#[allow(dead_code)] // TODO: remove when used
connection: Arc<DatabaseConnection>, connection: Arc<DatabaseConnection>,
} }

View File

@@ -13,7 +13,7 @@ chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
tokio = { version = "1.47.0", features = ["full"] } 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" log = "0.4.28"
[lints] [lints]

View File

@@ -11,11 +11,11 @@ path = "src/lib.rs"
[dependencies] [dependencies]
tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread"] } 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" log = "0.4.28"
[dependencies.sea-orm-migration] [dependencies.sea-orm-migration]
version = "2.0.0-rc" workspace = true
features = [ features = [
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
"sqlx-postgres", "sqlx-mysql", "sqlx-sqlite" # `DATABASE_DRIVER` features "sqlx-postgres", "sqlx-mysql", "sqlx-sqlite" # `DATABASE_DRIVER` features