.set(new_site)
.get_result::<Self>(conn)
}
+ fn delete(conn: &PgConnection, site_id: i32) -> Result<usize, Error> {
+ use lemmy_db_schema::schema::site::dsl::*;
+ diesel::delete(site.find(site_id)).execute(conn)
+ }
}
pub trait Site_ {
fn transfer(conn: &PgConnection, new_creator_id: i32) -> Result<Site, Error>;
+ fn read_simple(conn: &PgConnection) -> Result<Site, Error>;
}
impl Site_ for Site {
.set((creator_id.eq(new_creator_id), updated.eq(naive_now())))
.get_result::<Self>(conn)
}
+
+ fn read_simple(conn: &PgConnection) -> Result<Self, Error> {
+ use lemmy_db_schema::schema::site::dsl::*;
+ site.first::<Self>(conn)
+ }
}