refactor: fix HIGH+MEDIUM architectural violations from code review

HIGH: fix watch_medium data-loss bug, standardize error handling on
ApiError, fix dep direction (rss/template-askama no longer dep on
application), extract ImageFetcher port (remove reqwest from app layer),
move event construction from save_review to use case, extract
infra-wiring crate (DbPool/EventBusBackend dedup), deduplicate
presentation helpers (encode_error, export streaming, multipart parsing)

MEDIUM: split LocalApContentQuery god-trait 10→3 methods, dedup movie
resolution orchestration, add RemoteActorDto/PersonDto mappers, move
AppConfig to infra-wiring, fix SocialQueryPort Uuid→UserId, replace
stringly-typed api-types with domain enums, move count_reviews_in_year
to StatsRepository, dedup event publisher cfg blocks, extract
should_enrich, move group_by_month to application, dedup
count_local_posts, add FederationFlags Default, TUI input helper +
ShowError rename + typed auth errors, api-types cleanup
(UserSettingsDto/UserProfileBase/PreviewRowData)

102 files changed, -681 lines net
This commit is contained in:
2026-07-10 02:08:39 +02:00
parent 26152660bb
commit 12da356a40
110 changed files with 1399 additions and 1867 deletions

View File

@@ -86,7 +86,7 @@ impl MovieRepository for Panic {
}
#[async_trait::async_trait]
impl ReviewRepository for Panic {
async fn save_review(&self, _: &Review) -> Result<DomainEvent, DomainError> {
async fn save_review(&self, _: &Review) -> Result<(), DomainError> {
panic!()
}
async fn get_review_by_id(&self, _: &ReviewId) -> Result<Option<Review>, DomainError> {
@@ -154,7 +154,7 @@ impl DiaryRepository for Panic {
#[cfg(feature = "federation")]
#[async_trait::async_trait]
impl domain::ports::SocialQueryPort for Panic {
async fn get_accepted_following_urls(&self, _: uuid::Uuid) -> Result<Vec<String>, DomainError> {
async fn get_accepted_following_urls(&self, _: &UserId) -> Result<Vec<String>, DomainError> {
panic!()
}
async fn list_all_followed_remote_actors(
@@ -162,15 +162,15 @@ impl domain::ports::SocialQueryPort for Panic {
) -> Result<Vec<domain::models::RemoteActorInfo>, DomainError> {
panic!()
}
async fn count_following(&self, _: uuid::Uuid) -> Result<usize, DomainError> {
async fn count_following(&self, _: &UserId) -> Result<usize, DomainError> {
panic!()
}
async fn count_accepted_followers(&self, _: uuid::Uuid) -> Result<usize, DomainError> {
async fn count_accepted_followers(&self, _: &UserId) -> Result<usize, DomainError> {
panic!()
}
async fn get_pending_followers(
&self,
_: uuid::Uuid,
_: &UserId,
) -> Result<Vec<domain::models::PendingFollowerInfo>, DomainError> {
panic!()
}
@@ -183,6 +183,9 @@ impl StatsRepository for Panic {
async fn get_user_trends(&self, _: &UserId) -> Result<UserTrends, DomainError> {
panic!()
}
async fn count_reviews_in_year(&self, _: &UserId, _: u16) -> Result<u32, DomainError> {
panic!()
}
}
#[async_trait::async_trait]
impl MetadataClient for Panic {
@@ -424,7 +427,7 @@ impl domain::ports::DocumentParser for Panic {
}
}
impl application::ports::RssFeedRenderer for Panic {
impl domain::ports::RssFeedRenderer for Panic {
fn render_feed(&self, _: &[DiaryEntry], _: &str) -> Result<String, String> {
panic!()
}
@@ -700,13 +703,6 @@ impl domain::ports::GoalRepository for Panic {
) -> Result<Vec<domain::models::Goal>, DomainError> {
panic!()
}
async fn count_reviews_in_year(
&self,
_: &domain::value_objects::UserId,
_: u16,
) -> Result<u32, DomainError> {
panic!()
}
}
#[async_trait::async_trait]