2 newtypes::{CommunityId, DbUrl, PersonId, PostId},
3 schema::{post, post_like, post_read, post_saved},
5 use serde::{Deserialize, Serialize};
6 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
11 pub url: Option<DbUrl>,
12 pub body: Option<String>,
13 pub creator_id: PersonId,
14 pub community_id: CommunityId,
17 pub published: chrono::NaiveDateTime,
18 pub updated: Option<chrono::NaiveDateTime>,
22 pub embed_title: Option<String>,
23 pub embed_description: Option<String>,
24 pub embed_html: Option<String>,
25 pub thumbnail_url: Option<DbUrl>,
30 #[derive(Insertable, AsChangeset, Default)]
31 #[table_name = "post"]
34 pub creator_id: PersonId,
35 pub community_id: CommunityId,
36 pub nsfw: Option<bool>,
37 pub url: Option<DbUrl>,
38 pub body: Option<String>,
39 pub removed: Option<bool>,
40 pub locked: Option<bool>,
41 pub published: Option<chrono::NaiveDateTime>,
42 pub updated: Option<chrono::NaiveDateTime>,
43 pub deleted: Option<bool>,
44 pub stickied: Option<bool>,
45 pub embed_title: Option<String>,
46 pub embed_description: Option<String>,
47 pub embed_html: Option<String>,
48 pub thumbnail_url: Option<DbUrl>,
49 pub ap_id: Option<DbUrl>,
50 pub local: Option<bool>,
53 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
55 #[table_name = "post_like"]
59 pub person_id: PersonId,
61 pub published: chrono::NaiveDateTime,
64 #[derive(Insertable, AsChangeset, Clone)]
65 #[table_name = "post_like"]
66 pub struct PostLikeForm {
68 pub person_id: PersonId,
72 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
74 #[table_name = "post_saved"]
75 pub struct PostSaved {
78 pub person_id: PersonId,
79 pub published: chrono::NaiveDateTime,
82 #[derive(Insertable, AsChangeset)]
83 #[table_name = "post_saved"]
84 pub struct PostSavedForm {
86 pub person_id: PersonId,
89 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
91 #[table_name = "post_read"]
95 pub person_id: PersonId,
96 pub published: chrono::NaiveDateTime,
99 #[derive(Insertable, AsChangeset)]
100 #[table_name = "post_read"]
101 pub struct PostReadForm {
103 pub person_id: PersonId,