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 creator_name -> Varchar,
16 creator_avatar -> Nullable<Text>,
17 number_of_users -> BigInt,
18 number_of_posts -> BigInt,
19 number_of_comments -> BigInt,
20 number_of_communities -> BigInt,
25 Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
27 #[table_name = "site_view"]
31 pub description: Option<String>,
33 pub published: chrono::NaiveDateTime,
34 pub updated: Option<chrono::NaiveDateTime>,
35 pub enable_downvotes: bool,
36 pub open_registration: bool,
37 pub enable_nsfw: bool,
38 pub creator_name: String,
39 pub creator_avatar: Option<String>,
40 pub number_of_users: i64,
41 pub number_of_posts: i64,
42 pub number_of_comments: i64,
43 pub number_of_communities: i64,
47 pub fn read(conn: &PgConnection) -> Result<Self, Error> {
48 use super::site_view::site_view::dsl::*;
49 site_view.first::<Self>(conn)