diff --git a/src/lib.rs b/src/lib.rs index f87d49e..01750a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,9 +10,9 @@ mod http_signatures; mod ipfs; pub mod logger; pub mod mastodon_api; -pub mod models; -pub mod monero; +mod models; +mod monero; pub mod nodeinfo; pub mod scheduler; -pub mod utils; +mod utils; pub mod webfinger; diff --git a/src/models/posts/queries.rs b/src/models/posts/queries.rs index 59e676f..dcfef73 100644 --- a/src/models/posts/queries.rs +++ b/src/models/posts/queries.rs @@ -415,37 +415,6 @@ pub async fn get_local_timeline( Ok(posts) } -pub async fn get_posts( - db_client: &impl GenericClient, - posts_ids: Vec, -) -> Result, DatabaseError> { - let statement = format!( - " - SELECT - post, actor_profile, - {related_attachments}, - {related_mentions}, - {related_tags}, - {related_links} - FROM post - JOIN actor_profile ON post.author_id = actor_profile.id - WHERE post.id = ANY($1) - ", - related_attachments=RELATED_ATTACHMENTS, - related_mentions=RELATED_MENTIONS, - related_tags=RELATED_TAGS, - related_links=RELATED_LINKS, - ); - let rows = db_client.query( - statement.as_str(), - &[&posts_ids], - ).await?; - let posts: Vec = rows.iter() - .map(Post::try_from) - .collect::>()?; - Ok(posts) -} - pub async fn get_related_posts( db_client: &impl GenericClient, posts_ids: Vec, diff --git a/src/models/relationships/queries.rs b/src/models/relationships/queries.rs index f745c9c..c007ed4 100644 --- a/src/models/relationships/queries.rs +++ b/src/models/relationships/queries.rs @@ -238,24 +238,6 @@ pub async fn get_follow_request_by_id( Ok(request) } -pub async fn get_follow_request_by_path( - db_client: &impl GenericClient, - source_id: &Uuid, - target_id: &Uuid, -) -> Result { - let maybe_row = db_client.query_opt( - " - SELECT follow_request - FROM follow_request - WHERE source_id = $1 AND target_id = $2 - ", - &[&source_id, &target_id], - ).await?; - let row = maybe_row.ok_or(DatabaseError::NotFound("follow request"))?; - let request: DbFollowRequest = row.try_get("follow_request")?; - Ok(request) -} - pub async fn get_followers( db_client: &impl GenericClient, profile_id: &Uuid, @@ -557,11 +539,8 @@ mod tests { assert!(following.is_empty()); // Accept follow request follow_request_accepted(db_client, &follow_request.id).await.unwrap(); - let follow_request = get_follow_request_by_path( - db_client, - &source.id, - &target.id, - ).await.unwrap(); + let follow_request = get_follow_request_by_id(db_client, &follow_request.id) + .await.unwrap(); assert!(matches!( follow_request.request_status, FollowRequestStatus::Accepted,