]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/site.rs
Removing the site creator, adding leave_admin. Fixes #1808 (#2052)
[lemmy.git] / crates / db_schema / src / source / site.rs
1 use crate::{newtypes::DbUrl, schema::site};
2 use serde::{Deserialize, Serialize};
3
4 #[derive(Queryable, Identifiable, PartialEq, Debug, Clone, Serialize, Deserialize)]
5 #[table_name = "site"]
6 pub struct Site {
7   pub id: i32,
8   pub name: String,
9   pub sidebar: Option<String>,
10   pub published: chrono::NaiveDateTime,
11   pub updated: Option<chrono::NaiveDateTime>,
12   pub enable_downvotes: bool,
13   pub open_registration: bool,
14   pub enable_nsfw: bool,
15   pub icon: Option<DbUrl>,
16   pub banner: Option<DbUrl>,
17   pub description: Option<String>,
18   pub community_creation_admin_only: bool,
19   pub require_email_verification: bool,
20   pub require_application: bool,
21   pub application_question: Option<String>,
22   pub private_instance: bool,
23 }
24
25 #[derive(Insertable, AsChangeset, Default)]
26 #[table_name = "site"]
27 pub struct SiteForm {
28   pub name: String,
29   pub sidebar: Option<Option<String>>,
30   pub updated: Option<chrono::NaiveDateTime>,
31   pub enable_downvotes: Option<bool>,
32   pub open_registration: Option<bool>,
33   pub enable_nsfw: Option<bool>,
34   // 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.
35   pub icon: Option<Option<DbUrl>>,
36   pub banner: Option<Option<DbUrl>>,
37   pub description: Option<Option<String>>,
38   pub community_creation_admin_only: Option<bool>,
39   pub require_email_verification: Option<bool>,
40   pub require_application: Option<bool>,
41   pub application_question: Option<Option<String>>,
42   pub private_instance: Option<bool>,
43 }