1 use diesel::{result::Error, *};
3 aggregates::site_aggregates::SiteAggregates,
4 schema::{site, site_aggregates},
7 use serde::{Deserialize, Serialize};
9 #[derive(Debug, Serialize, Deserialize, Clone)]
12 pub counts: SiteAggregates,
16 pub fn read_local(conn: &PgConnection) -> Result<Self, Error> {
17 let (mut site, counts) = site::table
18 .inner_join(site_aggregates::table)
19 .select((site::all_columns, site_aggregates::all_columns))
21 .first::<(Site, SiteAggregates)>(conn)?;
23 site.private_key = None;
24 Ok(SiteView { site, counts })