refactor: LOW cleanups — dedup secure_flag, remove vestigial social_query,
drop PersistedImportSession, rename LoginQuery→LoginCommand, own DeleteAccountDeps, PersonId via uuid_id! macro, rename SortDirection→ ReviewSortBy, TUI fs::read→Command, generic PaginatedResponse<T>
This commit is contained in:
@@ -3,7 +3,7 @@ use uuid::Uuid;
|
||||
|
||||
use domain::{errors::DomainError, models::RefreshSession, value_objects::Email};
|
||||
|
||||
use crate::auth::{deps::LoginDeps, queries::LoginQuery};
|
||||
use crate::auth::{deps::LoginDeps, queries::LoginCommand};
|
||||
|
||||
pub struct LoginResult {
|
||||
pub token: String,
|
||||
@@ -14,7 +14,7 @@ pub struct LoginResult {
|
||||
pub role: domain::models::UserRole,
|
||||
}
|
||||
|
||||
pub async fn execute(deps: &LoginDeps, query: LoginQuery) -> Result<LoginResult, DomainError> {
|
||||
pub async fn execute(deps: &LoginDeps, query: LoginCommand) -> Result<LoginResult, DomainError> {
|
||||
let email = Email::new(query.email)?;
|
||||
let user = deps
|
||||
.user
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub struct LoginQuery {
|
||||
pub struct LoginCommand {
|
||||
pub email: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::auth::{
|
||||
commands::{RegisterAndLoginCommand, RegisterCommand},
|
||||
deps::{LoginDeps, RegisterAndLoginDeps, RegisterDeps},
|
||||
login::{self, LoginResult},
|
||||
queries::LoginQuery,
|
||||
queries::LoginCommand,
|
||||
register,
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ pub async fn execute(
|
||||
};
|
||||
login::execute(
|
||||
&log_deps,
|
||||
LoginQuery {
|
||||
LoginCommand {
|
||||
email: cmd.email,
|
||||
password: cmd.password,
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
commands::RegisterCommand,
|
||||
deps::{LoginDeps, RegisterDeps},
|
||||
login,
|
||||
queries::LoginQuery,
|
||||
queries::LoginCommand,
|
||||
register,
|
||||
},
|
||||
test_helpers::TestContextBuilder,
|
||||
@@ -48,7 +48,7 @@ async fn test_login_valid_credentials_returns_token() {
|
||||
};
|
||||
let result = login::execute(
|
||||
&deps,
|
||||
LoginQuery {
|
||||
LoginCommand {
|
||||
email: "carol@example.com".into(),
|
||||
password: "secret123".into(),
|
||||
},
|
||||
@@ -76,7 +76,7 @@ async fn test_login_wrong_password_fails() {
|
||||
};
|
||||
let result = login::execute(
|
||||
&deps,
|
||||
LoginQuery {
|
||||
LoginCommand {
|
||||
email: "dave@example.com".into(),
|
||||
password: "wrong_password".into(),
|
||||
},
|
||||
@@ -98,7 +98,7 @@ async fn test_login_unknown_email_fails() {
|
||||
};
|
||||
let result = login::execute(
|
||||
&deps,
|
||||
LoginQuery {
|
||||
LoginCommand {
|
||||
email: "nobody@example.com".into(),
|
||||
password: "anything".into(),
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
commands::RegisterCommand,
|
||||
deps::{LoginDeps, RefreshDeps, RegisterDeps},
|
||||
login, logout,
|
||||
queries::LoginQuery,
|
||||
queries::LoginCommand,
|
||||
refresh, register,
|
||||
},
|
||||
test_helpers::TestContextBuilder,
|
||||
@@ -45,7 +45,7 @@ async fn logout_revokes_refresh_token() {
|
||||
};
|
||||
let login_result = login::execute(
|
||||
&login_deps,
|
||||
LoginQuery {
|
||||
LoginCommand {
|
||||
email: "bob@example.com".into(),
|
||||
password: "password123".into(),
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
commands::RegisterCommand,
|
||||
deps::{LoginDeps, RefreshDeps, RegisterDeps},
|
||||
login,
|
||||
queries::LoginQuery,
|
||||
queries::LoginCommand,
|
||||
refresh, register,
|
||||
},
|
||||
test_helpers::TestContextBuilder,
|
||||
@@ -41,7 +41,7 @@ async fn login_user(b: &TestContextBuilder) -> login::LoginResult {
|
||||
};
|
||||
login::execute(
|
||||
&login_deps,
|
||||
LoginQuery {
|
||||
LoginCommand {
|
||||
email: "alice@example.com".into(),
|
||||
password: "password123".into(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user