refactor: restructure application to CQRS, update api-types + presentation

- application: replace flat use_cases/ with identity/{commands,queries}/ and organization/commands/
- each use case now split into Command/Query struct + Handler struct
- api-types: add username to RegisterRequest/UserResponse, add CreateAlbumRequest/AlbumResponse
- presentation: update state, handlers, factory to use new handler types
- tests: restructured to match CQRS module layout, added get_profile tests
This commit is contained in:
2026-05-31 05:00:34 +02:00
parent d62d8157a8
commit fa36bb8c0e
43 changed files with 305 additions and 168 deletions

View File

@@ -1,26 +1,26 @@
use std::sync::Arc;
use application::use_cases::{GetProfile, LoginUser, RegisterUser};
use application::identity::{RegisterUserHandler, LoginUserHandler, GetProfileHandler};
use domain::ports::{StoragePort, TokenIssuer};
#[derive(Clone)]
pub struct AppState {
pub register_uc: Arc<RegisterUser>,
pub login_uc: Arc<LoginUser>,
pub get_profile_uc: Arc<GetProfile>,
pub register_handler: Arc<RegisterUserHandler>,
pub login_handler: Arc<LoginUserHandler>,
pub get_profile_handler: Arc<GetProfileHandler>,
pub token_issuer: Arc<dyn TokenIssuer>,
pub storage: Arc<dyn StoragePort>,
}
impl AppState {
pub fn new(
register_uc: Arc<RegisterUser>,
login_uc: Arc<LoginUser>,
get_profile_uc: Arc<GetProfile>,
register_handler: Arc<RegisterUserHandler>,
login_handler: Arc<LoginUserHandler>,
get_profile_handler: Arc<GetProfileHandler>,
token_issuer: Arc<dyn TokenIssuer>,
storage: Arc<dyn StoragePort>,
) -> Self {
Self { register_uc, login_uc, get_profile_uc, token_issuer, storage }
Self { register_handler, login_handler, get_profile_handler, token_issuer, storage }
}
}