2024-09-19 11:15:04 +02:00
|
|
|
use crate::newtypes::{CustomEmojiId, DbUrl};
|
2023-08-24 17:27:00 +02:00
|
|
|
use chrono::{DateTime, Utc};
|
2025-04-03 23:21:27 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use lemmy_db_schema_file::schema::custom_emoji;
|
2023-03-20 16:32:31 -05:00
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 00:26:10 -04:00
|
|
|
use serde_with::skip_serializing_none;
|
2023-03-20 16:32:31 -05:00
|
|
|
|
2023-04-26 00:26:10 -04:00
|
|
|
#[skip_serializing_none]
|
2023-03-20 16:32:31 -05:00
|
|
|
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
2025-06-12 10:30:48 -04:00
|
|
|
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
2023-03-20 16:32:31 -05:00
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji))]
|
2023-11-21 08:42:28 -05:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2025-06-12 10:30:48 -04:00
|
|
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
|
|
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
2023-05-10 15:20:39 -04:00
|
|
|
/// A custom emoji.
|
2023-03-20 16:32:31 -05:00
|
|
|
pub struct CustomEmoji {
|
|
|
|
pub id: CustomEmojiId,
|
|
|
|
pub shortcode: String,
|
|
|
|
pub image_url: DbUrl,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub category: String,
|
2025-06-11 03:38:24 -04:00
|
|
|
pub published_at: DateTime<Utc>,
|
|
|
|
pub updated_at: Option<DateTime<Utc>>,
|
2023-03-20 16:32:31 -05:00
|
|
|
}
|
|
|
|
|
2024-09-20 14:15:25 +02:00
|
|
|
#[derive(Debug, Clone, derive_new::new)]
|
2023-03-20 16:32:31 -05:00
|
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji))]
|
|
|
|
pub struct CustomEmojiInsertForm {
|
|
|
|
pub shortcode: String,
|
|
|
|
pub image_url: DbUrl,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub category: String,
|
|
|
|
}
|
|
|
|
|
2024-09-20 14:15:25 +02:00
|
|
|
#[derive(Debug, Clone, derive_new::new)]
|
2023-03-20 16:32:31 -05:00
|
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji))]
|
|
|
|
pub struct CustomEmojiUpdateForm {
|
|
|
|
pub image_url: DbUrl,
|
|
|
|
pub alt_text: String,
|
|
|
|
pub category: String,
|
|
|
|
}
|