]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/aggregates/site_aggregates.rs
Cache & Optimize Woodpecker CI (#3450)
[lemmy.git] / crates / db_schema / src / aggregates / site_aggregates.rs
index cfc14df431e23185ea28c240a647f56ce7a6e7d1..ea3da85aeaf9e12c2601a834d79d0edc5a388634 100644 (file)
@@ -7,7 +7,7 @@ use diesel::result::Error;
 use diesel_async::RunQueryDsl;
 
 impl SiteAggregates {
-  pub async fn read(pool: &DbPool) -> Result<Self, Error> {
+  pub async fn read(pool: &mut DbPool<'_>) -> Result<Self, Error> {
     let conn = &mut get_conn(pool).await?;
     site_aggregates::table.first::<Self>(conn).await
   }
@@ -15,6 +15,9 @@ impl SiteAggregates {
 
 #[cfg(test)]
 mod tests {
+  #![allow(clippy::unwrap_used)]
+  #![allow(clippy::indexing_slicing)]
+
   use crate::{
     aggregates::site_aggregates::SiteAggregates,
     source::{
@@ -30,7 +33,9 @@ mod tests {
   };
   use serial_test::serial;
 
-  async fn prepare_site_with_community(pool: &DbPool) -> (Instance, Person, Site, Community) {
+  async fn prepare_site_with_community(
+    pool: &mut DbPool<'_>,
+  ) -> (Instance, Person, Site, Community) {
     let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string())
       .await
       .unwrap();
@@ -70,6 +75,7 @@ mod tests {
   #[serial]
   async fn test_crud() {
     let pool = &build_db_pool_for_tests().await;
+    let pool = &mut pool.into();
 
     let (inserted_instance, inserted_person, inserted_site, inserted_community) =
       prepare_site_with_community(pool).await;
@@ -143,6 +149,7 @@ mod tests {
   #[serial]
   async fn test_soft_delete() {
     let pool = &build_db_pool_for_tests().await;
+    let pool = &mut pool.into();
 
     let (inserted_instance, inserted_person, inserted_site, inserted_community) =
       prepare_site_with_community(pool).await;