-}
-
-type LocalUserSettingsViewTuple = (LocalUserSettings, PersonSafe, PersonAggregates);
-
-impl LocalUserSettingsView {
- pub async fn read(pool: &DbPool, local_user_id: LocalUserId) -> Result<Self, Error> {
- let conn = &mut get_conn(pool).await?;
- let (local_user, person, counts) = local_user::table
- .find(local_user_id)
- .inner_join(person::table)
- .inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id)))
- .select((
- LocalUser::safe_settings_columns_tuple(),
- Person::safe_columns_tuple(),
- person_aggregates::all_columns,
- ))
- .first::<LocalUserSettingsViewTuple>(conn)
- .await?;
- Ok(Self {
- local_user,
- person,
- counts,
- })
- }