|
|
|
@ -2,11 +2,9 @@ use crate::newtypes::{DbUrl, LocalUserId};
|
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
|
use crate::schema::{local_image, remote_image};
|
|
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
|
use std::fmt::Debug;
|
|
|
|
|
use typed_builder::TypedBuilder;
|
|
|
|
|
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
|
|
|
|
#[cfg_attr(feature = "full", derive(Queryable, Associations))]
|
|
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_image))]
|
|
|
|
@ -15,7 +13,7 @@ use typed_builder::TypedBuilder;
|
|
|
|
|
diesel(belongs_to(crate::source::local_user::LocalUser))
|
|
|
|
|
)]
|
|
|
|
|
pub struct LocalImage {
|
|
|
|
|
pub local_user_id: LocalUserId,
|
|
|
|
|
pub local_user_id: Option<LocalUserId>,
|
|
|
|
|
pub pictrs_alias: String,
|
|
|
|
|
pub pictrs_delete_token: String,
|
|
|
|
|
pub published: DateTime<Utc>,
|
|
|
|
@ -25,14 +23,13 @@ pub struct LocalImage {
|
|
|
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
|
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_image))]
|
|
|
|
|
pub struct LocalImageForm {
|
|
|
|
|
pub local_user_id: LocalUserId,
|
|
|
|
|
pub local_user_id: Option<LocalUserId>,
|
|
|
|
|
pub pictrs_alias: String,
|
|
|
|
|
pub pictrs_delete_token: String,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Stores all images which are hosted on remote domains. When attempting to proxy an image, it
|
|
|
|
|
/// is checked against this table to avoid Lemmy being used as a general purpose proxy.
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
|
|
|
|
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
|
|
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = remote_image))]
|
|
|
|
|