From 9d77cd0a13b9dcb7f0f4a06aa76ddbd81771907e Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 20 Sep 2024 15:13:34 +0200 Subject: [PATCH] cleanup --- crates/api_common/src/utils.rs | 2 +- crates/db_schema/src/impls/images.rs | 11 ++--------- crates/db_schema/src/source/images.rs | 7 ------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index b2db87367d..8ef527dcc8 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -1212,7 +1212,7 @@ mod tests { assert!( RemoteImage::validate(&mut context.pool(), remote_image.into()) .await - .is_err() + .is_ok() ); } } diff --git a/crates/db_schema/src/impls/images.rs b/crates/db_schema/src/impls/images.rs index 48dc575953..5383e5161c 100644 --- a/crates/db_schema/src/impls/images.rs +++ b/crates/db_schema/src/impls/images.rs @@ -1,14 +1,7 @@ use crate::{ newtypes::DbUrl, schema::{image_details, local_image, remote_image}, - source::images::{ - ImageDetails, - ImageDetailsForm, - LocalImage, - LocalImageForm, - RemoteImage, - RemoteImageForm, - }, + source::images::{ImageDetails, ImageDetailsForm, LocalImage, LocalImageForm, RemoteImage}, utils::{get_conn, DbPool}, }; use diesel::{ @@ -65,7 +58,7 @@ impl RemoteImage { let conn = &mut get_conn(pool).await?; let forms = links .into_iter() - .map(|url| RemoteImageForm { link: url.into() }) + .map(|url| remote_image::link.eq::(url.into())) .collect::>(); insert_into(remote_image::table) .values(forms) diff --git a/crates/db_schema/src/source/images.rs b/crates/db_schema/src/source/images.rs index 0dea4b84fa..22f5e6eb4b 100644 --- a/crates/db_schema/src/source/images.rs +++ b/crates/db_schema/src/source/images.rs @@ -51,13 +51,6 @@ pub struct RemoteImage { pub published: DateTime, } -#[derive(Debug, Clone)] -#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))] -#[cfg_attr(feature = "full", diesel(table_name = remote_image))] -pub struct RemoteImageForm { - pub link: DbUrl, -} - #[skip_serializing_none] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]