fix: clippy too-many-args on update_remote_review, use RemoteReviewUpdate struct

This commit is contained in:
2026-07-10 00:41:51 +02:00
parent cde2f5aaae
commit 081a20ae31
5 changed files with 43 additions and 60 deletions

View File

@@ -22,7 +22,7 @@ pub use k_ap::{
pub use event_handler::ActivityPubEventHandler;
pub use port::{ActivityPubPort, NoopActivityPubService};
pub use remote_review_repository::RemoteReviewRepository;
pub use remote_review_repository::{RemoteReviewRepository, RemoteReviewUpdate};
pub use review_handler::ReviewObjectHandler;
pub use user_adapter::DomainUserRepoAdapter;

View File

@@ -3,6 +3,16 @@ use async_trait::async_trait;
use chrono::NaiveDateTime;
use domain::models::Review;
pub struct RemoteReviewUpdate<'a> {
pub ap_id: &'a str,
pub actor_url: &'a str,
pub rating: u8,
pub comment: Option<&'a str>,
pub watched_at: NaiveDateTime,
pub poster_url: Option<&'a str>,
pub watch_medium: Option<&'a str>,
}
#[async_trait]
pub trait RemoteReviewRepository: Send + Sync {
async fn save_remote_review(
@@ -17,16 +27,7 @@ pub trait RemoteReviewRepository: Send + Sync {
async fn delete_remote_review(&self, ap_id: &str, actor_url: &str) -> Result<()>;
async fn update_remote_review(
&self,
ap_id: &str,
actor_url: &str,
rating: u8,
comment: Option<&str>,
watched_at: NaiveDateTime,
poster_url: Option<&str>,
watch_medium: Option<&str>,
) -> Result<()>;
async fn update_remote_review(&self, update: RemoteReviewUpdate<'_>) -> Result<()>;
async fn delete_by_actor(&self, actor_url: &str) -> Result<()>;
}

View File

@@ -188,15 +188,15 @@ impl ApObjectHandler for ReviewObjectHandler {
}
self.review_store
.update_remote_review(
ap_id.as_str(),
actor_url.as_str(),
obj.rating.min(5),
obj.comment.as_deref(),
obj.watched_at.naive_utc(),
obj.poster_url.as_deref(),
obj.watch_medium.as_deref(),
)
.update_remote_review(crate::remote_review_repository::RemoteReviewUpdate {
ap_id: ap_id.as_str(),
actor_url: actor_url.as_str(),
rating: obj.rating.min(5),
comment: obj.comment.as_deref(),
watched_at: obj.watched_at.naive_utc(),
poster_url: obj.poster_url.as_deref(),
watch_medium: obj.watch_medium.as_deref(),
})
.await?;
Ok(())