feat(storage): add generic object storage adapter with CQRS traits, key validation, StorageConfig, and cargo-generate integration

This commit is contained in:
2026-05-23 22:34:24 +02:00
parent 3fa46a4d58
commit 11e75f9bb4
21 changed files with 1246 additions and 15 deletions

View 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 %} }
}
}