refactor app service
This commit is contained in:
@@ -12,12 +12,8 @@ use crate::{
|
||||
configs::{ProgramSettings, server::CORSSettings},
|
||||
middlewares,
|
||||
services::{
|
||||
auth::{
|
||||
authentication::{AuthenticationService, strategies::password::PasswordStrategy},
|
||||
user::UserService,
|
||||
},
|
||||
server_state::ServerStateStore,
|
||||
settings::SettingsStore,
|
||||
AppService, ServiceState,
|
||||
auth::authentication::{AuthenticationService, strategies::password::PasswordStrategy},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,8 +24,6 @@ pub struct AppState {
|
||||
pub config: Arc<ProgramSettings>,
|
||||
}
|
||||
|
||||
pub type ServiceState<T> = Arc<T>;
|
||||
|
||||
pub struct AuthStrategy {
|
||||
pub password: ServiceState<PasswordStrategy>,
|
||||
}
|
||||
@@ -39,13 +33,6 @@ pub struct AuthState {
|
||||
pub authentication: ServiceState<dyn AuthenticationService>,
|
||||
}
|
||||
|
||||
pub struct AppService {
|
||||
pub settings: ServiceState<dyn SettingsStore>,
|
||||
pub auth_state: AuthState,
|
||||
pub user: ServiceState<dyn UserService>,
|
||||
pub server_state: ServiceState<dyn ServerStateStore>,
|
||||
}
|
||||
|
||||
pub fn get_root_router(
|
||||
state: impl Into<Arc<AppState>>,
|
||||
cors_settings: Arc<CORSSettings>,
|
||||
|
||||
Reference in New Issue
Block a user