fix: remove unused watch_event_query binding, prefix dead field for clippy -D warnings

This commit is contained in:
2026-07-10 04:32:54 +02:00
parent 2e32847129
commit 5266646b0b
20 changed files with 79 additions and 69 deletions

View File

@@ -33,16 +33,15 @@ impl k_ap::EventPublisher for FederationEventBridge {
inbox, inbox,
activity, activity,
signing_actor_id, signing_actor_id,
} => { } => self
self.domain_publisher .domain_publisher
.publish(&DomainEvent::FederationDeliveryRequested { .publish(&DomainEvent::FederationDeliveryRequested {
inbox_url: inbox.to_string(), inbox_url: inbox.to_string(),
activity_json: activity, activity_json: activity,
signing_actor_id, signing_actor_id,
}) })
.await .await
.map_err(|e| anyhow::anyhow!(e.to_string())) .map_err(|e| anyhow::anyhow!(e.to_string())),
}
FederationEvent::DeliveryFailed { inbox, error, .. } => { FederationEvent::DeliveryFailed { inbox, error, .. } => {
tracing::warn!(inbox = %inbox, error = %error, "federation delivery failed permanently"); tracing::warn!(inbox = %inbox, error = %error, "federation delivery failed permanently");
Ok(()) Ok(())

View File

@@ -1,15 +1,8 @@
use domain::{ use domain::{errors::DomainError, events::DomainEvent, value_objects::UserId};
errors::DomainError,
events::DomainEvent,
value_objects::UserId,
};
use super::{commands::DeleteGoalCommand, deps::GoalCommandDeps}; use super::{commands::DeleteGoalCommand, deps::GoalCommandDeps};
pub async fn execute( pub async fn execute(deps: &GoalCommandDeps, cmd: DeleteGoalCommand) -> Result<(), DomainError> {
deps: &GoalCommandDeps,
cmd: DeleteGoalCommand,
) -> Result<(), DomainError> {
let user_id = UserId::from_uuid(cmd.user_id); let user_id = UserId::from_uuid(cmd.user_id);
let g = deps let g = deps

View File

@@ -1,8 +1,4 @@
use domain::{ use domain::{errors::DomainError, models::GoalWithProgress, value_objects::UserId};
errors::DomainError,
models::GoalWithProgress,
value_objects::UserId,
};
use super::{deps::GoalQueryDeps, queries::GetGoalQuery}; use super::{deps::GoalQueryDeps, queries::GetGoalQuery};
@@ -12,11 +8,17 @@ pub async fn execute(
) -> Result<Option<GoalWithProgress>, DomainError> { ) -> Result<Option<GoalWithProgress>, DomainError> {
let user_id = UserId::from_uuid(query.user_id); let user_id = UserId::from_uuid(query.user_id);
let found = deps.goal.find_by_user_and_year(&user_id, query.year).await?; let found = deps
.goal
.find_by_user_and_year(&user_id, query.year)
.await?;
let Some(g) = found else { return Ok(None) }; let Some(g) = found else { return Ok(None) };
let current_count = deps.stats.count_reviews_in_year(&user_id, query.year).await?; let current_count = deps
.stats
.count_reviews_in_year(&user_id, query.year)
.await?;
Ok(Some(GoalWithProgress { Ok(Some(GoalWithProgress {
goal: g, goal: g,

View File

@@ -1,8 +1,4 @@
use domain::{ use domain::{errors::DomainError, models::GoalWithProgress, value_objects::UserId};
errors::DomainError,
models::GoalWithProgress,
value_objects::UserId,
};
use super::{deps::GoalQueryDeps, queries::ListGoalsQuery}; use super::{deps::GoalQueryDeps, queries::ListGoalsQuery};

View File

@@ -1,8 +1,5 @@
use domain::{ use domain::{
errors::DomainError, errors::DomainError, events::DomainEvent, models::GoalWithProgress, value_objects::UserId,
events::DomainEvent,
models::GoalWithProgress,
value_objects::UserId,
}; };
use super::{commands::UpdateGoalCommand, deps::GoalCommandDeps}; use super::{commands::UpdateGoalCommand, deps::GoalCommandDeps};

View File

@@ -17,7 +17,9 @@ pub async fn execute(
cmd: CreateImportSessionCommand, cmd: CreateImportSessionCommand,
) -> Result<CreateSessionResult, DomainError> { ) -> Result<CreateSessionResult, DomainError> {
let user_id = UserId::from_uuid(cmd.user_id); let user_id = UserId::from_uuid(cmd.user_id);
deps.import_session.delete_expired_for_user(&user_id).await?; deps.import_session
.delete_expired_for_user(&user_id)
.await?;
let parsed = deps let parsed = deps
.document_parser .document_parser

View File

@@ -5,7 +5,9 @@ use domain::{errors::DomainError, ports::WatchEventCommand};
pub async fn execute(watch_event_command: Arc<dyn WatchEventCommand>) -> Result<u64, DomainError> { pub async fn execute(watch_event_command: Arc<dyn WatchEventCommand>) -> Result<u64, DomainError> {
let cutoff = chrono::Utc::now().naive_utc() - Duration::days(30); let cutoff = chrono::Utc::now().naive_utc() - Duration::days(30);
watch_event_command.delete_non_pending_older_than(cutoff).await watch_event_command
.delete_non_pending_older_than(cutoff)
.await
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -9,10 +9,9 @@ use domain::{
GoalRepository, ImportProfileRepository, ImportSessionRepository, MetadataClient, GoalRepository, ImportProfileRepository, ImportSessionRepository, MetadataClient,
MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage, PasswordHasher, MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage, PasswordHasher,
PersonCommand, PersonQuery, PosterFetcherClient, RefreshSessionRepository, PersonCommand, PersonQuery, PosterFetcherClient, RefreshSessionRepository,
ReviewRepository, SearchCommand, SearchPort, StatsRepository, ReviewRepository, SearchCommand, SearchPort, StatsRepository, UserProfileFieldsRepository,
UserProfileFieldsRepository, UserRepository, UserSettingsRepository, WatchEventCommand, UserRepository, UserSettingsRepository, WatchEventCommand, WatchEventQuery,
WatchEventQuery, WatchlistRepository, WebhookTokenRepository, WatchlistRepository, WebhookTokenRepository, WrapUpRepository, WrapUpStatsQuery,
WrapUpRepository, WrapUpStatsQuery,
}, },
testing::{ testing::{
FakeAuthService, FakeDiaryRepository, FakeDocumentParser, FakeMetadataClient, FakeAuthService, FakeDiaryRepository, FakeDocumentParser, FakeMetadataClient,

View File

@@ -22,9 +22,9 @@ async fn upload_image(
let ct = content_type.unwrap_or(""); let ct = content_type.unwrap_or("");
if !["image/jpeg", "image/png", "image/webp"].contains(&ct) { if !["image/jpeg", "image/png", "image/webp"].contains(&ct) {
return Err(DomainError::ValidationError( return Err(DomainError::ValidationError(format!(
format!("{kind} must be jpeg, png, or webp"), "{kind} must be jpeg, png, or webp"
)); )));
} }
if let Some(old) = old_path { if let Some(old) = old_path {

View File

@@ -1,6 +1,8 @@
use std::sync::Arc; use std::sync::Arc;
use domain::ports::{EventPublisher, MetadataClient, MovieCommand, MovieQuery, WatchlistRepository}; use domain::ports::{
EventPublisher, MetadataClient, MovieCommand, MovieQuery, WatchlistRepository,
};
pub struct WatchlistAddDeps { pub struct WatchlistAddDeps {
pub movie_command: Arc<dyn MovieCommand>, pub movie_command: Arc<dyn MovieCommand>,

View File

@@ -17,11 +17,11 @@ use crate::{
collections::{PageParams, Paginated}, collections::{PageParams, Paginated},
}, },
ports::{ ports::{
GoalRepository, ImportProfileRepository, ImportSessionRepository, MovieProfileRepository, GoalRepository, ImportProfileRepository, ImportSessionRepository, MovieCommand,
MovieCommand, MovieQuery, RefreshSessionRepository, ReviewRepository, MovieProfileRepository, MovieQuery, RefreshSessionRepository, ReviewRepository,
UserFederationSettingsQuery, UserProfileFieldsRepository, UserRepository, UserFederationSettingsQuery, UserProfileFieldsRepository, UserRepository,
UserSettingsRepository, WatchEventCommand, WatchEventQuery, UserSettingsRepository, WatchEventCommand, WatchEventQuery, WatchlistRepository,
WatchlistRepository, WebhookTokenRepository, WebhookTokenRepository,
}, },
value_objects::{ value_objects::{
Email, ExternalMetadataId, GoalId, ImportProfileId, ImportSessionId, MovieId, MovieTitle, Email, ExternalMetadataId, GoalId, ImportProfileId, ImportSessionId, MovieId, MovieTitle,
@@ -604,7 +604,6 @@ impl WatchEventQuery for InMemoryWatchEventRepository {
&& *e.watched_at() > after && *e.watched_at() > after
})) }))
} }
} }
// ── InMemoryImportSessionRepository ───────────────────────────────────────── // ── InMemoryImportSessionRepository ─────────────────────────────────────────

View File

@@ -3,13 +3,12 @@ use std::sync::Arc;
use domain::ports::{ use domain::ports::{
AuthService, DiaryExporter, DiaryRepository, DocumentParser, EventPublisher, AuthService, DiaryExporter, DiaryRepository, DocumentParser, EventPublisher,
FederatedProfileQuery, GoalRepository, ImportProfileRepository, ImportSessionRepository, FederatedProfileQuery, GoalRepository, ImportProfileRepository, ImportSessionRepository,
MetadataClient, MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage, PasswordHasher, MetadataClient, MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage,
PersonCommand, PersonEnrichmentClient, PersonQuery, PosterFetcherClient, PasswordHasher, PersonCommand, PersonEnrichmentClient, PersonQuery, PosterFetcherClient,
RefreshSessionRepository, RemoteGoalRepository, RemoteWatchlistRepository, ReviewRepository, RefreshSessionRepository, RemoteGoalRepository, RemoteWatchlistRepository, ReviewRepository,
SearchCommand, SearchPort, SocialQueryPort, StatsRepository, UserProfileFieldsRepository, SearchCommand, SearchPort, SocialQueryPort, StatsRepository, UserProfileFieldsRepository,
UserRepository, UserSettingsRepository, WatchEventCommand, WatchEventQuery, UserRepository, UserSettingsRepository, WatchEventCommand, WatchEventQuery,
WatchlistRepository, WatchlistRepository, WebhookTokenRepository, WrapUpRepository, WrapUpStatsQuery,
WebhookTokenRepository, WrapUpRepository, WrapUpStatsQuery,
}; };
use application::config::AppConfig; use application::config::AppConfig;

View File

@@ -40,9 +40,17 @@ impl IntoResponse for ApiError {
match &self.0 { match &self.0 {
DomainError::InfrastructureError(_) => { DomainError::InfrastructureError(_) => {
tracing::error!("Internal error: {:?}", self.0); tracing::error!("Internal error: {:?}", self.0);
(status, axum::Json(serde_json::json!({"error": "internal server error"}))).into_response() (
status,
axum::Json(serde_json::json!({"error": "internal server error"})),
)
.into_response()
} }
_ => (status, axum::Json(serde_json::json!({"error": self.0.to_string()}))).into_response(), _ => (
status,
axum::Json(serde_json::json!({"error": self.0.to_string()})),
)
.into_response(),
} }
} }
} }

View File

@@ -3,8 +3,8 @@ use std::sync::Arc;
use anyhow::Context; use anyhow::Context;
use domain::ports::{ use domain::ports::{
AuthService, LocalApContentQuery, MetadataClient, ObjectStorage, PasswordHasher, AuthService, LocalApContentQuery, MetadataClient, ObjectStorage, PasswordHasher,
PosterFetcherClient, RefreshSessionRepository, UserProfileFieldsRepository, PosterFetcherClient, RefreshSessionRepository, UserProfileFieldsRepository, WatchEventCommand,
WatchEventCommand, WatchEventQuery, WebhookTokenRepository, WatchEventQuery, WebhookTokenRepository,
}; };
pub use infra_wiring::DbPool; pub use infra_wiring::DbPool;

View File

@@ -19,7 +19,9 @@ use application::import::{
DeleteImportProfileCommand, ExecuteImportCommand, SaveImportProfileCommand, DeleteImportProfileCommand, ExecuteImportCommand, SaveImportProfileCommand,
}, },
create_session as create_import_session, delete_profile as delete_import_profile, create_session as create_import_session, delete_profile as delete_import_profile,
deps::{ApplyMappingDeps, ApplyProfileDeps, CreateSessionDeps, ExecuteImportDeps, SaveProfileDeps}, deps::{
ApplyMappingDeps, ApplyProfileDeps, CreateSessionDeps, ExecuteImportDeps, SaveProfileDeps,
},
execute as execute_import, list_profiles as list_import_profiles, execute as execute_import, list_profiles as list_import_profiles,
save_profile as save_import_profile, save_profile as save_import_profile,
}; };

View File

@@ -204,7 +204,13 @@ pub async fn post_dismiss_single(
event_ids: vec![event_id], event_ids: vec![event_id],
}; };
match dismiss_watch_events::execute(state.app_ctx.repos.watch_event_command.clone(), state.app_ctx.repos.watch_event_query.clone(), cmd).await { match dismiss_watch_events::execute(
state.app_ctx.repos.watch_event_command.clone(),
state.app_ctx.repos.watch_event_query.clone(),
cmd,
)
.await
{
Ok(_) => Redirect::to("/watch-queue").into_response(), Ok(_) => Redirect::to("/watch-queue").into_response(),
Err(e) => { Err(e) => {
let msg = encode_error(&e.to_string()); let msg = encode_error(&e.to_string());

View File

@@ -251,7 +251,8 @@ pub async fn get_watch_queue(
let query = GetWatchQueueQuery { let query = GetWatchQueueQuery {
user_id: user.0.value(), user_id: user.0.value(),
}; };
let events = get_watch_queue::execute(state.app_ctx.repos.watch_event_query.clone(), query).await?; let events =
get_watch_queue::execute(state.app_ctx.repos.watch_event_query.clone(), query).await?;
let dtos = events let dtos = events
.into_iter() .into_iter()
@@ -326,7 +327,11 @@ pub async fn post_dismiss_watch_events(
event_ids: req.event_ids, event_ids: req.event_ids,
}; };
let dismissed = let dismissed = dismiss_watch_events::execute(
dismiss_watch_events::execute(state.app_ctx.repos.watch_event_command.clone(), state.app_ctx.repos.watch_event_query.clone(), cmd).await?; state.app_ctx.repos.watch_event_command.clone(),
state.app_ctx.repos.watch_event_query.clone(),
cmd,
)
.await?;
Ok(Json(DismissWatchResponse { dismissed })) Ok(Json(DismissWatchResponse { dismissed }))
} }

View File

@@ -1,6 +1,6 @@
use api_types::{ use api_types::{
ProfileFieldDto, ProfileResponse, ProfileViewData, UpdateProfileFieldsRequest, ProfileFieldDto, ProfileResponse, ProfileViewData, UpdateProfileFieldsRequest, UserProfileBase,
UserProfileBase, UserProfileResponse, UserStatsDto, UserSummaryDto, UsersResponse, UserProfileResponse, UserStatsDto, UserSummaryDto, UsersResponse,
}; };
use utoipa::OpenApi; use utoipa::OpenApi;

View File

@@ -21,7 +21,7 @@ pub struct WorkerDbOutput {
pub import_session: Arc<dyn ImportSessionRepository>, pub import_session: Arc<dyn ImportSessionRepository>,
pub movie_profile: Arc<dyn MovieProfileRepository>, pub movie_profile: Arc<dyn MovieProfileRepository>,
pub watch_event_command: Arc<dyn WatchEventCommand>, pub watch_event_command: Arc<dyn WatchEventCommand>,
pub watch_event_query: Arc<dyn WatchEventQuery>, pub _watch_event_query: Arc<dyn WatchEventQuery>,
pub person_command: Arc<dyn PersonCommand>, pub person_command: Arc<dyn PersonCommand>,
pub person_query: Arc<dyn PersonQuery>, pub person_query: Arc<dyn PersonQuery>,
pub search_command: Arc<dyn SearchCommand>, pub search_command: Arc<dyn SearchCommand>,
@@ -60,7 +60,7 @@ pub async fn connect(database_url: &str, backend: &str) -> anyhow::Result<Worker
import_session: w.import_session, import_session: w.import_session,
movie_profile: w.movie_profile, movie_profile: w.movie_profile,
watch_event_command: we.clone() as _, watch_event_command: we.clone() as _,
watch_event_query: we as _, _watch_event_query: we as _,
person_command, person_command,
person_query, person_query,
search_command, search_command,
@@ -99,7 +99,7 @@ pub async fn connect(database_url: &str, backend: &str) -> anyhow::Result<Worker
import_session: w.import_session, import_session: w.import_session,
movie_profile: w.movie_profile, movie_profile: w.movie_profile,
watch_event_command: we.clone() as _, watch_event_command: we.clone() as _,
watch_event_query: we as _, _watch_event_query: we as _,
person_command, person_command,
person_query, person_query,
search_command, search_command,

View File

@@ -83,7 +83,6 @@ async fn main() -> anyhow::Result<()> {
let import_session = db.import_session; let import_session = db.import_session;
let movie_profile = db.movie_profile; let movie_profile = db.movie_profile;
let watch_event_command = db.watch_event_command; let watch_event_command = db.watch_event_command;
let watch_event_query = db.watch_event_query;
let person_command = db.person_command; let person_command = db.person_command;
let person_query = db.person_query; let person_query = db.person_query;
let search_command = db.search_command; let search_command = db.search_command;