1 use diesel::{result::Error, *};
2 use serde::{Deserialize, Serialize};
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,
28 Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
30 #[table_name = "site_view"]
34 pub description: Option<String>,
36 pub published: chrono::NaiveDateTime,
37 pub updated: Option<chrono::NaiveDateTime>,
38 pub enable_downvotes: bool,
39 pub open_registration: bool,
40 pub enable_nsfw: bool,
41 pub icon: Option<String>,
42 pub banner: Option<String>,
43 pub creator_name: String,
44 pub creator_preferred_username: Option<String>,
45 pub creator_avatar: Option<String>,
46 pub number_of_users: i64,
47 pub number_of_posts: i64,
48 pub number_of_comments: i64,
49 pub number_of_communities: i64,
53 pub fn read(conn: &PgConnection) -> Result<Self, Error> {
54 use super::site_view::site_view::dsl::*;
55 site_view.first::<Self>(conn)