use crate::{ auth::AuthProvider, models::{ ids::UserId, users::{Badges, Role, UserPayoutData}, }, }; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct LegacyUser { pub id: UserId, pub username: String, pub name: Option, pub avatar_url: Option, pub bio: Option, pub created: DateTime, pub role: Role, pub badges: Badges, pub auth_providers: Option>, // this was changed in v3, but not changes ones we want to keep out of v2 pub email: Option, pub email_verified: Option, pub has_password: Option, pub has_totp: Option, pub payout_data: Option, // this was changed in v3, but not ones we want to keep out of v2 // DEPRECATED. Always returns None pub github_id: Option, } impl From for LegacyUser { fn from(data: crate::models::v3::users::User) -> Self { Self { id: data.id, username: data.username, name: data.name, email: data.email, email_verified: data.email_verified, avatar_url: data.avatar_url, bio: data.bio, created: data.created, role: data.role, badges: data.badges, payout_data: data.payout_data, auth_providers: data.auth_providers, has_password: data.has_password, has_totp: data.has_totp, github_id: data.github_id, } } }