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:
2026-07-10 05:04:35 +02:00
parent 5266646b0b
commit 5e0dde656c
37 changed files with 167 additions and 218 deletions

View File

@@ -10,12 +10,12 @@ use application::auth::{
commands::RegisterCommand,
deps::{LoginDeps, RefreshDeps, RegisterAndLoginDeps, RegisterDeps},
login as login_uc,
queries::LoginQuery,
queries::LoginCommand,
register as register_uc,
};
use crate::{
csrf::CsrfToken,
csrf::{CsrfToken, secure_flag},
errors::ApiError,
forms::{ErrorQuery, LoginForm, RegisterForm},
render::render_page,
@@ -29,14 +29,6 @@ use template_askama::{LoginTemplate, RegisterTemplate};
// ── HTML helpers ─────────────────────────────────────────────────────────────
fn secure_flag() -> &'static str {
if std::env::var("SECURE_COOKIES").as_deref() == Ok("true") {
"; Secure"
} else {
""
}
}
fn set_cookie_header(token: &str, max_age: i64) -> (axum::http::HeaderName, HeaderValue) {
let val = format!(
"token={}; HttpOnly; Path=/; SameSite=Strict; Max-Age={}{}",
@@ -73,7 +65,7 @@ pub async fn login(
};
let result = login_uc::execute(
&deps,
LoginQuery {
LoginCommand {
email: req.email,
password: req.password,
},
@@ -204,7 +196,7 @@ pub async fn post_login(
};
match login_uc::execute(
&deps,
LoginQuery {
LoginCommand {
email: form.email,
password: form.password,
},

View File

@@ -6,7 +6,7 @@ use axum::{
use uuid::Uuid;
use application::{diary::get_diary, diary::queries::GetDiaryQuery};
use domain::{errors::DomainError, models::SortDirection, value_objects::UserId};
use domain::{errors::DomainError, models::ReviewSortBy, value_objects::UserId};
use crate::{errors::ApiError, state::AppState};
@@ -14,7 +14,7 @@ pub async fn get_feed(State(state): State<AppState>) -> Result<impl IntoResponse
let query = GetDiaryQuery {
limit: Some(super::RSS_FEED_LIMIT),
offset: Some(0),
sort_by: Some(SortDirection::Descending),
sort_by: Some(ReviewSortBy::Descending),
movie_id: None,
user_id: None,
};
@@ -45,7 +45,7 @@ pub async fn get_user_feed(
let query = GetDiaryQuery {
limit: Some(super::RSS_FEED_LIMIT),
offset: Some(0),
sort_by: Some(SortDirection::Descending),
sort_by: Some(ReviewSortBy::Descending),
movie_id: None,
user_id: Some(user_id),
};