fix: remove unused watch_event_query binding, prefix dead field for clippy -D warnings
This commit is contained in:
@@ -33,16 +33,15 @@ impl k_ap::EventPublisher for FederationEventBridge {
|
||||
inbox,
|
||||
activity,
|
||||
signing_actor_id,
|
||||
} => {
|
||||
self.domain_publisher
|
||||
.publish(&DomainEvent::FederationDeliveryRequested {
|
||||
inbox_url: inbox.to_string(),
|
||||
activity_json: activity,
|
||||
signing_actor_id,
|
||||
})
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!(e.to_string()))
|
||||
}
|
||||
} => self
|
||||
.domain_publisher
|
||||
.publish(&DomainEvent::FederationDeliveryRequested {
|
||||
inbox_url: inbox.to_string(),
|
||||
activity_json: activity,
|
||||
signing_actor_id,
|
||||
})
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!(e.to_string())),
|
||||
FederationEvent::DeliveryFailed { inbox, error, .. } => {
|
||||
tracing::warn!(inbox = %inbox, error = %error, "federation delivery failed permanently");
|
||||
Ok(())
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
events::DomainEvent,
|
||||
value_objects::UserId,
|
||||
};
|
||||
use domain::{errors::DomainError, events::DomainEvent, value_objects::UserId};
|
||||
|
||||
use super::{commands::DeleteGoalCommand, deps::GoalCommandDeps};
|
||||
|
||||
pub async fn execute(
|
||||
deps: &GoalCommandDeps,
|
||||
cmd: DeleteGoalCommand,
|
||||
) -> Result<(), DomainError> {
|
||||
pub async fn execute(deps: &GoalCommandDeps, cmd: DeleteGoalCommand) -> Result<(), DomainError> {
|
||||
let user_id = UserId::from_uuid(cmd.user_id);
|
||||
|
||||
let g = deps
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
models::GoalWithProgress,
|
||||
value_objects::UserId,
|
||||
};
|
||||
use domain::{errors::DomainError, models::GoalWithProgress, value_objects::UserId};
|
||||
|
||||
use super::{deps::GoalQueryDeps, queries::GetGoalQuery};
|
||||
|
||||
@@ -12,11 +8,17 @@ pub async fn execute(
|
||||
) -> Result<Option<GoalWithProgress>, DomainError> {
|
||||
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 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 {
|
||||
goal: g,
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
models::GoalWithProgress,
|
||||
value_objects::UserId,
|
||||
};
|
||||
use domain::{errors::DomainError, models::GoalWithProgress, value_objects::UserId};
|
||||
|
||||
use super::{deps::GoalQueryDeps, queries::ListGoalsQuery};
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
events::DomainEvent,
|
||||
models::GoalWithProgress,
|
||||
value_objects::UserId,
|
||||
errors::DomainError, events::DomainEvent, models::GoalWithProgress, value_objects::UserId,
|
||||
};
|
||||
|
||||
use super::{commands::UpdateGoalCommand, deps::GoalCommandDeps};
|
||||
|
||||
@@ -17,7 +17,9 @@ pub async fn execute(
|
||||
cmd: CreateImportSessionCommand,
|
||||
) -> Result<CreateSessionResult, DomainError> {
|
||||
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
|
||||
.document_parser
|
||||
|
||||
@@ -5,7 +5,9 @@ use domain::{errors::DomainError, ports::WatchEventCommand};
|
||||
|
||||
pub async fn execute(watch_event_command: Arc<dyn WatchEventCommand>) -> Result<u64, DomainError> {
|
||||
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)]
|
||||
|
||||
@@ -9,10 +9,9 @@ use domain::{
|
||||
GoalRepository, ImportProfileRepository, ImportSessionRepository, MetadataClient,
|
||||
MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage, PasswordHasher,
|
||||
PersonCommand, PersonQuery, PosterFetcherClient, RefreshSessionRepository,
|
||||
ReviewRepository, SearchCommand, SearchPort, StatsRepository,
|
||||
UserProfileFieldsRepository, UserRepository, UserSettingsRepository, WatchEventCommand,
|
||||
WatchEventQuery, WatchlistRepository, WebhookTokenRepository,
|
||||
WrapUpRepository, WrapUpStatsQuery,
|
||||
ReviewRepository, SearchCommand, SearchPort, StatsRepository, UserProfileFieldsRepository,
|
||||
UserRepository, UserSettingsRepository, WatchEventCommand, WatchEventQuery,
|
||||
WatchlistRepository, WebhookTokenRepository, WrapUpRepository, WrapUpStatsQuery,
|
||||
},
|
||||
testing::{
|
||||
FakeAuthService, FakeDiaryRepository, FakeDocumentParser, FakeMetadataClient,
|
||||
|
||||
@@ -22,9 +22,9 @@ async fn upload_image(
|
||||
|
||||
let ct = content_type.unwrap_or("");
|
||||
if !["image/jpeg", "image/png", "image/webp"].contains(&ct) {
|
||||
return Err(DomainError::ValidationError(
|
||||
format!("{kind} must be jpeg, png, or webp"),
|
||||
));
|
||||
return Err(DomainError::ValidationError(format!(
|
||||
"{kind} must be jpeg, png, or webp"
|
||||
)));
|
||||
}
|
||||
|
||||
if let Some(old) = old_path {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::ports::{EventPublisher, MetadataClient, MovieCommand, MovieQuery, WatchlistRepository};
|
||||
use domain::ports::{
|
||||
EventPublisher, MetadataClient, MovieCommand, MovieQuery, WatchlistRepository,
|
||||
};
|
||||
|
||||
pub struct WatchlistAddDeps {
|
||||
pub movie_command: Arc<dyn MovieCommand>,
|
||||
|
||||
@@ -17,11 +17,11 @@ use crate::{
|
||||
collections::{PageParams, Paginated},
|
||||
},
|
||||
ports::{
|
||||
GoalRepository, ImportProfileRepository, ImportSessionRepository, MovieProfileRepository,
|
||||
MovieCommand, MovieQuery, RefreshSessionRepository, ReviewRepository,
|
||||
GoalRepository, ImportProfileRepository, ImportSessionRepository, MovieCommand,
|
||||
MovieProfileRepository, MovieQuery, RefreshSessionRepository, ReviewRepository,
|
||||
UserFederationSettingsQuery, UserProfileFieldsRepository, UserRepository,
|
||||
UserSettingsRepository, WatchEventCommand, WatchEventQuery,
|
||||
WatchlistRepository, WebhookTokenRepository,
|
||||
UserSettingsRepository, WatchEventCommand, WatchEventQuery, WatchlistRepository,
|
||||
WebhookTokenRepository,
|
||||
},
|
||||
value_objects::{
|
||||
Email, ExternalMetadataId, GoalId, ImportProfileId, ImportSessionId, MovieId, MovieTitle,
|
||||
@@ -604,7 +604,6 @@ impl WatchEventQuery for InMemoryWatchEventRepository {
|
||||
&& *e.watched_at() > after
|
||||
}))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ── InMemoryImportSessionRepository ─────────────────────────────────────────
|
||||
|
||||
@@ -3,13 +3,12 @@ use std::sync::Arc;
|
||||
use domain::ports::{
|
||||
AuthService, DiaryExporter, DiaryRepository, DocumentParser, EventPublisher,
|
||||
FederatedProfileQuery, GoalRepository, ImportProfileRepository, ImportSessionRepository,
|
||||
MetadataClient, MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage, PasswordHasher,
|
||||
PersonCommand, PersonEnrichmentClient, PersonQuery, PosterFetcherClient,
|
||||
MetadataClient, MovieCommand, MovieProfileRepository, MovieQuery, ObjectStorage,
|
||||
PasswordHasher, PersonCommand, PersonEnrichmentClient, PersonQuery, PosterFetcherClient,
|
||||
RefreshSessionRepository, RemoteGoalRepository, RemoteWatchlistRepository, ReviewRepository,
|
||||
SearchCommand, SearchPort, SocialQueryPort, StatsRepository, UserProfileFieldsRepository,
|
||||
UserRepository, UserSettingsRepository, WatchEventCommand, WatchEventQuery,
|
||||
WatchlistRepository,
|
||||
WebhookTokenRepository, WrapUpRepository, WrapUpStatsQuery,
|
||||
WatchlistRepository, WebhookTokenRepository, WrapUpRepository, WrapUpStatsQuery,
|
||||
};
|
||||
|
||||
use application::config::AppConfig;
|
||||
|
||||
@@ -40,9 +40,17 @@ impl IntoResponse for ApiError {
|
||||
match &self.0 {
|
||||
DomainError::InfrastructureError(_) => {
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::sync::Arc;
|
||||
use anyhow::Context;
|
||||
use domain::ports::{
|
||||
AuthService, LocalApContentQuery, MetadataClient, ObjectStorage, PasswordHasher,
|
||||
PosterFetcherClient, RefreshSessionRepository, UserProfileFieldsRepository,
|
||||
WatchEventCommand, WatchEventQuery, WebhookTokenRepository,
|
||||
PosterFetcherClient, RefreshSessionRepository, UserProfileFieldsRepository, WatchEventCommand,
|
||||
WatchEventQuery, WebhookTokenRepository,
|
||||
};
|
||||
|
||||
pub use infra_wiring::DbPool;
|
||||
|
||||
@@ -19,7 +19,9 @@ use application::import::{
|
||||
DeleteImportProfileCommand, ExecuteImportCommand, SaveImportProfileCommand,
|
||||
},
|
||||
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,
|
||||
save_profile as save_import_profile,
|
||||
};
|
||||
|
||||
@@ -204,7 +204,13 @@ pub async fn post_dismiss_single(
|
||||
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(),
|
||||
Err(e) => {
|
||||
let msg = encode_error(&e.to_string());
|
||||
|
||||
@@ -251,7 +251,8 @@ pub async fn get_watch_queue(
|
||||
let query = GetWatchQueueQuery {
|
||||
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
|
||||
.into_iter()
|
||||
@@ -326,7 +327,11 @@ pub async fn post_dismiss_watch_events(
|
||||
event_ids: req.event_ids,
|
||||
};
|
||||
|
||||
let dismissed =
|
||||
dismiss_watch_events::execute(state.app_ctx.repos.watch_event_command.clone(), state.app_ctx.repos.watch_event_query.clone(), cmd).await?;
|
||||
let dismissed = dismiss_watch_events::execute(
|
||||
state.app_ctx.repos.watch_event_command.clone(),
|
||||
state.app_ctx.repos.watch_event_query.clone(),
|
||||
cmd,
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(DismissWatchResponse { dismissed }))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use api_types::{
|
||||
ProfileFieldDto, ProfileResponse, ProfileViewData, UpdateProfileFieldsRequest,
|
||||
UserProfileBase, UserProfileResponse, UserStatsDto, UserSummaryDto, UsersResponse,
|
||||
ProfileFieldDto, ProfileResponse, ProfileViewData, UpdateProfileFieldsRequest, UserProfileBase,
|
||||
UserProfileResponse, UserStatsDto, UserSummaryDto, UsersResponse,
|
||||
};
|
||||
use utoipa::OpenApi;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ pub struct WorkerDbOutput {
|
||||
pub import_session: Arc<dyn ImportSessionRepository>,
|
||||
pub movie_profile: Arc<dyn MovieProfileRepository>,
|
||||
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_query: Arc<dyn PersonQuery>,
|
||||
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,
|
||||
movie_profile: w.movie_profile,
|
||||
watch_event_command: we.clone() as _,
|
||||
watch_event_query: we as _,
|
||||
_watch_event_query: we as _,
|
||||
person_command,
|
||||
person_query,
|
||||
search_command,
|
||||
@@ -99,7 +99,7 @@ pub async fn connect(database_url: &str, backend: &str) -> anyhow::Result<Worker
|
||||
import_session: w.import_session,
|
||||
movie_profile: w.movie_profile,
|
||||
watch_event_command: we.clone() as _,
|
||||
watch_event_query: we as _,
|
||||
_watch_event_query: we as _,
|
||||
person_command,
|
||||
person_query,
|
||||
search_command,
|
||||
|
||||
@@ -83,7 +83,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
let import_session = db.import_session;
|
||||
let movie_profile = db.movie_profile;
|
||||
let watch_event_command = db.watch_event_command;
|
||||
let watch_event_query = db.watch_event_query;
|
||||
let person_command = db.person_command;
|
||||
let person_query = db.person_query;
|
||||
let search_command = db.search_command;
|
||||
|
||||
Reference in New Issue
Block a user