- new_removed: bool,
- ) -> Result<Community, Error> {
- use crate::schema::community::dsl::*;
- diesel::update(community.find(community_id))
- .set((removed.eq(new_removed), updated.eq(naive_now())))
- .get_result::<Self>(conn)
- }
-
- pub fn distinct_federated_communities(conn: &PgConnection) -> Result<Vec<String>, Error> {
- use crate::schema::community::dsl::*;
- community.select(actor_id).distinct().load::<String>(conn)
- }
-
- pub fn read_from_followers_url(
- conn: &PgConnection,
- followers_url_: &DbUrl,
- ) -> Result<Community, Error> {
- use crate::schema::community::dsl::*;
- community
- .filter(followers_url.eq(followers_url_))
- .first::<Self>(conn)
- }
-
- pub fn upsert(conn: &PgConnection, community_form: &CommunityForm) -> Result<Community, Error> {
- use crate::schema::community::dsl::*;
- insert_into(community)
- .values(community_form)
- .on_conflict(actor_id)
- .do_update()
- .set(community_form)
+ form: &Self::UpdateForm,
+ ) -> Result<Self, Error> {
+ let conn = &mut get_conn(pool).await?;
+ diesel::update(community::table.find(community_id))
+ .set(form)