headless_talk/channel/normal/
user.rs

1use crate::{
2    database::model::user::{normal::NormalChannelUserModel, UserProfileModel},
3    user::UserProfile,
4};
5
6#[derive(Debug, Clone)]
7pub struct NormalChannelUser {
8    pub country_iso: String,
9
10    pub account_id: i64,
11    pub status_message: String,
12    pub linked_services: String,
13
14    pub suspended: bool,
15
16    pub watermark: i64,
17
18    pub profile: UserProfile,
19}
20
21impl NormalChannelUser {
22    pub(super) fn from_models(profile: UserProfileModel, user: NormalChannelUserModel) -> Self {
23        Self {
24            country_iso: user.country_iso,
25            account_id: user.account_id,
26            status_message: user.status_message,
27            linked_services: user.linked_services,
28            suspended: user.suspended,
29            watermark: profile.watermark.unwrap_or(0),
30            profile: UserProfile::from(profile),
31        }
32    }
33}