1 use diesel::{result::Error, *};
8 description -> Nullable<Text>,
10 published -> Timestamp,
11 updated -> Nullable<Timestamp>,
12 enable_downvotes -> Bool,
13 open_registration -> Bool,
15 icon -> Nullable<Text>,
16 banner -> Nullable<Text>,
17 creator_name -> Varchar,
18 creator_preferred_username -> Nullable<Varchar>,
19 creator_avatar -> Nullable<Text>,
20 number_of_users -> BigInt,
21 number_of_posts -> BigInt,
22 number_of_comments -> BigInt,
23 number_of_communities -> BigInt,
27 #[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone)]
28 #[table_name = "site_view"]
32 pub description: Option<String>,
34 pub published: chrono::NaiveDateTime,
35 pub updated: Option<chrono::NaiveDateTime>,
36 pub enable_downvotes: bool,
37 pub open_registration: bool,
38 pub enable_nsfw: bool,
39 pub icon: Option<String>,
40 pub banner: Option<String>,
41 pub creator_name: String,
42 pub creator_preferred_username: Option<String>,
43 pub creator_avatar: Option<String>,
44 pub number_of_users: i64,
45 pub number_of_posts: i64,
46 pub number_of_comments: i64,
47 pub number_of_communities: i64,
51 pub fn read(conn: &PgConnection) -> Result<Self, Error> {
52 use super::site_view::site_view::dsl::*;
53 site_view.first::<Self>(conn)