1 use diesel::{result::Error, *};
2 use lemmy_db_queries::{aggregates::site_aggregates::SiteAggregates, ToSafe};
4 schema::{site, site_aggregates, person},
7 person::{PersonSafe, Person},
12 #[derive(Debug, Serialize, Clone)]
15 pub creator: PersonSafe,
16 pub counts: SiteAggregates,
20 pub fn read(conn: &PgConnection) -> Result<Self, Error> {
21 let (site, creator, counts) = site::table
22 .inner_join(person::table)
23 .inner_join(site_aggregates::table)
26 Person::safe_columns_tuple(),
27 site_aggregates::all_columns,
29 .first::<(Site, PersonSafe, SiteAggregates)>(conn)?;