fix: remove unused watch_event_query binding, prefix dead field for clippy -D warnings
This commit is contained in:
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user