X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_schema%2Fsrc%2Fimpls%2Fcomment_reply.rs;h=eeb171f58e657276297e183005ca4524a4f36176;hb=92568956353f21649ed9aff68b42699c9d036f30;hp=73ecd35898b84a26e59e4ffd1083504a1cf9e297;hpb=6f3bf4634b0e1cf529c4683d6ee971917e2bfa50;p=lemmy.git diff --git a/crates/db_schema/src/impls/comment_reply.rs b/crates/db_schema/src/impls/comment_reply.rs index 73ecd358..eeb171f5 100644 --- a/crates/db_schema/src/impls/comment_reply.rs +++ b/crates/db_schema/src/impls/comment_reply.rs @@ -13,7 +13,7 @@ impl Crud for CommentReply { type InsertForm = CommentReplyInsertForm; type UpdateForm = CommentReplyUpdateForm; type IdType = CommentReplyId; - async fn read(pool: &DbPool, comment_reply_id: CommentReplyId) -> Result { + async fn read(pool: &mut DbPool<'_>, comment_reply_id: CommentReplyId) -> Result { let conn = &mut get_conn(pool).await?; comment_reply .find(comment_reply_id) @@ -21,7 +21,10 @@ impl Crud for CommentReply { .await } - async fn create(pool: &DbPool, comment_reply_form: &Self::InsertForm) -> Result { + async fn create( + pool: &mut DbPool<'_>, + comment_reply_form: &Self::InsertForm, + ) -> Result { let conn = &mut get_conn(pool).await?; // since the return here isnt utilized, we dont need to do an update @@ -36,7 +39,7 @@ impl Crud for CommentReply { } async fn update( - pool: &DbPool, + pool: &mut DbPool<'_>, comment_reply_id: CommentReplyId, comment_reply_form: &Self::UpdateForm, ) -> Result { @@ -50,7 +53,7 @@ impl Crud for CommentReply { impl CommentReply { pub async fn mark_all_as_read( - pool: &DbPool, + pool: &mut DbPool<'_>, for_recipient_id: PersonId, ) -> Result, Error> { let conn = &mut get_conn(pool).await?; @@ -64,7 +67,10 @@ impl CommentReply { .await } - pub async fn read_by_comment(pool: &DbPool, for_comment_id: CommentId) -> Result { + pub async fn read_by_comment( + pool: &mut DbPool<'_>, + for_comment_id: CommentId, + ) -> Result { let conn = &mut get_conn(pool).await?; comment_reply .filter(comment_id.eq(for_comment_id)) @@ -75,6 +81,9 @@ impl CommentReply { #[cfg(test)] mod tests { + #![allow(clippy::unwrap_used)] + #![allow(clippy::indexing_slicing)] + use crate::{ source::{ comment::{Comment, CommentInsertForm}, @@ -93,8 +102,11 @@ mod tests { #[serial] async fn test_crud() { let pool = &build_db_pool_for_tests().await; + let pool = &mut pool.into(); - let inserted_instance = Instance::create(pool, "my_domain.tld").await.unwrap(); + let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string()) + .await + .unwrap(); let new_person = PersonInsertForm::builder() .name("terrylake".into())