use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
-mod safe_settings_type {
- use crate::{
- schema::local_user::columns::{
- accepted_application,
- default_listing_type,
- default_sort_type,
- email,
- email_verified,
- id,
- interface_language,
- person_id,
- send_notifications_to_email,
- show_avatars,
- show_bot_accounts,
- show_new_post_notifs,
- show_nsfw,
- show_read_posts,
- show_scores,
- theme,
- validator_time,
- },
- source::local_user::LocalUser,
- traits::ToSafeSettings,
- };
-
- type Columns = (
- id,
- person_id,
- email,
- show_nsfw,
- theme,
- default_sort_type,
- default_listing_type,
- interface_language,
- show_avatars,
- send_notifications_to_email,
- validator_time,
- show_bot_accounts,
- show_scores,
- show_read_posts,
- show_new_post_notifs,
- email_verified,
- accepted_application,
- );
-
- impl ToSafeSettings for LocalUser {
- type SafeSettingsColumns = Columns;
-
- /// Includes everything but the hashed password
- fn safe_settings_columns_tuple() -> Self::SafeSettingsColumns {
- (
- id,
- person_id,
- email,
- show_nsfw,
- theme,
- default_sort_type,
- default_listing_type,
- interface_language,
- show_avatars,
- send_notifications_to_email,
- validator_time,
- show_bot_accounts,
- show_scores,
- show_read_posts,
- show_new_post_notifs,
- email_verified,
- accepted_application,
- )
- }
- }
-}
-
impl LocalUser {
pub async fn update_password(
pool: &DbPool,