refactor: group use cases into DDD bounded contexts
Flat use_cases/ (44 files) + monolithic commands.rs/queries.rs split into diary/, movies/, watchlist/, import/, auth/, users/, integrations/, search/, person/, federation/ — each with own commands.rs, queries.rs, and use case modules. Inline tests extracted to sibling tests/ dirs.
This commit is contained in:
32
crates/application/src/auth/register_and_login.rs
Normal file
32
crates/application/src/auth/register_and_login.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use domain::errors::DomainError;
|
||||
|
||||
use crate::{
|
||||
auth::commands::RegisterAndLoginCommand,
|
||||
auth::{login, register},
|
||||
context::AppContext,
|
||||
};
|
||||
|
||||
pub async fn execute(
|
||||
ctx: &AppContext,
|
||||
cmd: RegisterAndLoginCommand,
|
||||
) -> Result<login::LoginResult, DomainError> {
|
||||
register::execute(
|
||||
ctx,
|
||||
crate::auth::commands::RegisterCommand {
|
||||
email: cmd.email.clone(),
|
||||
username: cmd.username,
|
||||
password: cmd.password.clone(),
|
||||
role: domain::models::UserRole::Standard,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
login::execute(
|
||||
ctx,
|
||||
crate::auth::queries::LoginQuery {
|
||||
email: cmd.email,
|
||||
password: cmd.password,
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
Reference in New Issue
Block a user