feat(storage): add generic object storage adapter with CQRS traits, key validation, StorageConfig, and cargo-generate integration
This commit is contained in:
28
crates/presentation/src/state.rs.liquid
Normal file
28
crates/presentation/src/state.rs.liquid
Normal file
@@ -0,0 +1,28 @@
|
||||
use std::sync::Arc;
|
||||
use application::use_cases::{GetProfile, LoginUser, RegisterUser};
|
||||
{% if storage %}
|
||||
use domain::ports::{StoragePort, TokenIssuer};
|
||||
{% else %}
|
||||
use domain::ports::TokenIssuer;
|
||||
{% endif %}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub register_uc: Arc<RegisterUser>,
|
||||
pub login_uc: Arc<LoginUser>,
|
||||
pub get_profile_uc: Arc<GetProfile>,
|
||||
pub token_issuer: Arc<dyn TokenIssuer>,
|
||||
{% if storage %}pub storage: Arc<dyn StoragePort>,{% endif %}
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub fn new(
|
||||
register_uc: Arc<RegisterUser>,
|
||||
login_uc: Arc<LoginUser>,
|
||||
get_profile_uc: Arc<GetProfile>,
|
||||
token_issuer: Arc<dyn TokenIssuer>,
|
||||
{% if storage %}storage: Arc<dyn StoragePort>,{% endif %}
|
||||
) -> Self {
|
||||
Self { register_uc, login_uc, get_profile_uc, token_issuer{% if storage %}, storage{% endif %} }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user