Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Sep 20, 2024
1 parent 7a39307 commit 9d77cd0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion crates/api_common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ mod tests {
assert!(
RemoteImage::validate(&mut context.pool(), remote_image.into())
.await
.is_err()
.is_ok()
);
}
}
11 changes: 2 additions & 9 deletions crates/db_schema/src/impls/images.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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::<DbUrl>(url.into()))
.collect::<Vec<_>>();
insert_into(remote_image::table)
.values(forms)
Expand Down
7 changes: 0 additions & 7 deletions crates/db_schema/src/source/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ pub struct RemoteImage {
pub published: DateTime<Utc>,
}

#[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))]
Expand Down

0 comments on commit 9d77cd0

Please sign in to comment.