]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/site.rs
Upgrading deps (#1995)
[lemmy.git] / crates / db_schema / src / source / site.rs
1 use crate::{
2   newtypes::{DbUrl, PersonId},
3   schema::site,
4 };
5 use serde::{Deserialize, Serialize};
6
7 #[derive(Queryable, Identifiable, PartialEq, Debug, Clone, Serialize, Deserialize)]
8 #[table_name = "site"]
9 pub struct Site {
10   pub id: i32,
11   pub name: String,
12   pub sidebar: Option<String>,
13   pub creator_id: PersonId,
14   pub published: chrono::NaiveDateTime,
15   pub updated: Option<chrono::NaiveDateTime>,
16   pub enable_downvotes: bool,
17   pub open_registration: bool,
18   pub enable_nsfw: bool,
19   pub icon: Option<DbUrl>,
20   pub banner: Option<DbUrl>,
21   pub description: Option<String>,
22   pub community_creation_admin_only: bool,
23 }
24
25 #[derive(Insertable, AsChangeset)]
26 #[table_name = "site"]
27 pub struct SiteForm {
28   pub name: String,
29   pub creator_id: PersonId,
30   pub sidebar: Option<Option<String>>,
31   pub updated: Option<chrono::NaiveDateTime>,
32   pub enable_downvotes: Option<bool>,
33   pub open_registration: Option<bool>,
34   pub enable_nsfw: Option<bool>,
35   // when you want to null out a column, you have to send Some(None)), since sending None means you just don't want to update that column.
36   pub icon: Option<Option<DbUrl>>,
37   pub banner: Option<Option<DbUrl>>,
38   pub description: Option<Option<String>>,
39   pub community_creation_admin_only: Option<bool>,
40 }