pub fn read_from_name(conn: &PgConnection, community_name: &str) -> Result<Self, Error> {
use crate::schema::community::dsl::*;
community
- .filter(local)
+ .filter(local.eq(true))
.filter(name.eq(community_name))
.first::<Self>(conn)
}
}
pub fn read_from_name(conn: &PgConnection, from_user_name: &str) -> Result<Self, Error> {
- user_.filter(name.eq(from_user_name)).first::<Self>(conn)
+ user_
+ .filter(local.eq(true))
+ .filter(name.eq(from_user_name))
+ .first::<Self>(conn)
}
pub fn add_admin(conn: &PgConnection, user_id: i32, added: bool) -> Result<Self, Error> {
pub fn find_by_username(conn: &PgConnection, username: &str) -> Result<User_, Error> {
user_
- .filter(local)
+ .filter(local.eq(true))
.filter(name.ilike(username))
.first::<User_>(conn)
}
pub fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<User_, Error> {
user_
- .filter(local)
+ .filter(local.eq(true))
.filter(email.eq(from_email))
.first::<User_>(conn)
}