fedimovies/src/mastodon_api/users/types.rs
2021-09-14 12:24:05 +00:00

25 lines
568 B
Rust

use serde::Serialize;
use uuid::Uuid;
use crate::mastodon_api::accounts::types::Account;
use crate::models::users::types::User;
// TODO: use Account instead
#[derive(Serialize)]
pub struct ApiUser {
pub id: Uuid,
pub profile: Account,
pub wallet_address: String,
}
impl ApiUser {
pub fn from_user(user: User, instance_url: &str) -> Self {
let account = Account::from_profile(user.profile, instance_url);
Self {
id: user.id,
profile: account,
wallet_address: user.wallet_address,
}
}
}