type LocalUserViewTuple = (LocalUser, Person, PersonAggregates);
impl LocalUserView {
- pub async fn read(pool: &DbPool, local_user_id: LocalUserId) -> Result<Self, Error> {
+ pub async fn read(pool: &mut DbPool<'_>, local_user_id: LocalUserId) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let (local_user, person, counts) = local_user::table
})
}
- pub async fn read_person(pool: &DbPool, person_id: PersonId) -> Result<Self, Error> {
+ pub async fn read_person(pool: &mut DbPool<'_>, person_id: PersonId) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let (local_user, person, counts) = local_user::table
.filter(person::id.eq(person_id))
})
}
- // TODO check where this is used
- pub async fn read_from_name(pool: &DbPool, name: &str) -> Result<Self, Error> {
+ pub async fn read_from_name(pool: &mut DbPool<'_>, name: &str) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let (local_user, person, counts) = local_user::table
- .filter(person::name.eq(name))
+ .filter(lower(person::name).eq(name.to_lowercase()))
.inner_join(person::table)
.inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id)))
.select((
})
}
- pub async fn find_by_email_or_name(pool: &DbPool, name_or_email: &str) -> Result<Self, Error> {
+ pub async fn find_by_email_or_name(
+ pool: &mut DbPool<'_>,
+ name_or_email: &str,
+ ) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let (local_user, person, counts) = local_user::table
.inner_join(person::table)
})
}
- pub async fn find_by_email(pool: &DbPool, from_email: &str) -> Result<Self, Error> {
+ pub async fn find_by_email(pool: &mut DbPool<'_>, from_email: &str) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let (local_user, person, counts) = local_user::table
.inner_join(person::table)
})
}
- pub async fn list_admins_with_emails(pool: &DbPool) -> Result<Vec<Self>, Error> {
+ pub async fn list_admins_with_emails(pool: &mut DbPool<'_>) -> Result<Vec<Self>, Error> {
let conn = &mut get_conn(pool).await?;
let res = local_user::table
.filter(person::admin.eq(true))