]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/custom_emoji_keyword.rs
Automatically resolve report when post/comment is removed (#3850)
[lemmy.git] / crates / db_schema / src / source / custom_emoji_keyword.rs
1 use crate::newtypes::CustomEmojiId;
2 #[cfg(feature = "full")]
3 use crate::schema::custom_emoji_keyword;
4 use serde::{Deserialize, Serialize};
5 #[cfg(feature = "full")]
6 use ts_rs::TS;
7 use typed_builder::TypedBuilder;
8
9 #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
10 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
11 #[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))]
12 #[cfg_attr(
13   feature = "full",
14   diesel(belongs_to(crate::source::custom_emoji::CustomEmoji))
15 )]
16 #[cfg_attr(feature = "full", ts(export))]
17 /// A custom keyword for an emoji.
18 pub struct CustomEmojiKeyword {
19   pub id: i32,
20   pub custom_emoji_id: CustomEmojiId,
21   pub keyword: String,
22 }
23
24 #[derive(Debug, Clone, TypedBuilder)]
25 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
26 #[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))]
27 pub struct CustomEmojiKeywordInsertForm {
28   pub custom_emoji_id: CustomEmojiId,
29   pub keyword: String,
30 }