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

@@ -1,8 +1,8 @@
use domain::{errors::DomainError, events::DomainEvent, value_objects::UserId};
use crate::users::deps::UpdateProfileDeps;
use crate::users::deps::DeleteAccountDeps;
pub async fn execute(deps: &UpdateProfileDeps, user_id: uuid::Uuid) -> Result<(), DomainError> {
pub async fn execute(deps: &DeleteAccountDeps, user_id: uuid::Uuid) -> Result<(), DomainError> {
let uid = UserId::from_uuid(user_id);
deps.user

View File

@@ -16,3 +16,8 @@ pub struct UpdateProfileDeps {
pub object_storage: Arc<dyn ObjectStorage>,
pub event_publisher: Arc<dyn EventPublisher>,
}
pub struct DeleteAccountDeps {
pub user: Arc<dyn UserRepository>,
pub event_publisher: Arc<dyn EventPublisher>,
}

View File

@@ -6,7 +6,7 @@ use domain::{
errors::DomainError,
models::FeedSortBy,
models::{
DiaryEntry, DiaryFilter, SortDirection, UserStats, UserTrends,
DiaryEntry, DiaryFilter, ReviewSortBy, UserStats, UserTrends,
collections::{PageParams, Paginated},
},
value_objects::UserId,
@@ -108,18 +108,18 @@ async fn load_social_counts(
(following, followers, pending)
}
fn feed_sort_to_direction(sort_by: FeedSortBy) -> SortDirection {
fn feed_sort_to_direction(sort_by: FeedSortBy) -> ReviewSortBy {
match sort_by {
FeedSortBy::Date => SortDirection::Descending,
FeedSortBy::DateAsc => SortDirection::Ascending,
FeedSortBy::Rating => SortDirection::ByRatingDesc,
FeedSortBy::RatingAsc => SortDirection::ByRatingAsc,
FeedSortBy::Date => ReviewSortBy::Descending,
FeedSortBy::DateAsc => ReviewSortBy::Ascending,
FeedSortBy::Rating => ReviewSortBy::ByRatingDesc,
FeedSortBy::RatingAsc => ReviewSortBy::ByRatingAsc,
}
}
fn paged_user_filter(
user_id: UserId,
sort_by: SortDirection,
sort_by: ReviewSortBy,
limit: Option<u32>,
offset: Option<u32>,
search: Option<String>,
@@ -149,19 +149,19 @@ mod helper_tests {
use domain::models::FeedSortBy;
assert!(matches!(
feed_sort_to_direction(FeedSortBy::Date),
SortDirection::Descending
ReviewSortBy::Descending
));
assert!(matches!(
feed_sort_to_direction(FeedSortBy::DateAsc),
SortDirection::Ascending
ReviewSortBy::Ascending
));
assert!(matches!(
feed_sort_to_direction(FeedSortBy::Rating),
SortDirection::ByRatingDesc
ReviewSortBy::ByRatingDesc
));
assert!(matches!(
feed_sort_to_direction(FeedSortBy::RatingAsc),
SortDirection::ByRatingAsc
ReviewSortBy::ByRatingAsc
));
}
@@ -170,7 +170,7 @@ mod helper_tests {
let uid = UserId::from_uuid(uuid::Uuid::new_v4());
let filter = paged_user_filter(
uid.clone(),
SortDirection::Descending,
ReviewSortBy::Descending,
Some(20),
Some(5),
Some("blade".into()),