]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/impls/person_block.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / db_schema / src / impls / person_block.rs
index 9cd275563219ea0da788eb46f9ba5f27eb0526fb..0d125cd516701fe2bf70147c12080879c1deac46 100644 (file)
@@ -10,7 +10,7 @@ use diesel_async::RunQueryDsl;
 
 impl PersonBlock {
   pub async fn read(
-    pool: &DbPool,
+    pool: &mut DbPool<'_>,
     for_person_id: PersonId,
     for_recipient_id: PersonId,
   ) -> Result<Self, Error> {
@@ -26,7 +26,10 @@ impl PersonBlock {
 #[async_trait]
 impl Blockable for PersonBlock {
   type Form = PersonBlockForm;
-  async fn block(pool: &DbPool, person_block_form: &PersonBlockForm) -> Result<Self, Error> {
+  async fn block(
+    pool: &mut DbPool<'_>,
+    person_block_form: &PersonBlockForm,
+  ) -> Result<Self, Error> {
     let conn = &mut get_conn(pool).await?;
     insert_into(person_block)
       .values(person_block_form)
@@ -36,7 +39,7 @@ impl Blockable for PersonBlock {
       .get_result::<Self>(conn)
       .await
   }
-  async fn unblock(pool: &DbPool, person_block_form: &Self::Form) -> Result<usize, Error> {
+  async fn unblock(pool: &mut DbPool<'_>, person_block_form: &Self::Form) -> Result<usize, Error> {
     let conn = &mut get_conn(pool).await?;
     diesel::delete(
       person_block