|
|
|
@ -112,7 +112,10 @@ impl User_ {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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> {
|
|
|
|
@ -145,14 +148,14 @@ impl User_ {
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|