AppFlowy/rust-lib/flowy-user/src/entities/user_detail.rs

40 lines
781 B
Rust
Raw Normal View History

use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
#[derive(Debug, ProtoBuf_Enum)]
pub enum UserStatus {
Unknown = 0,
Login = 1,
Expired = 2,
}
impl std::default::Default for UserStatus {
fn default() -> Self { UserStatus::Unknown }
}
#[derive(ProtoBuf, Default, Debug)]
pub struct UserDetail {
#[pb(index = 1)]
pub id: String,
#[pb(index = 2)]
pub email: String,
#[pb(index = 3)]
pub name: String,
#[pb(index = 4)]
pub status: UserStatus,
}
use crate::sql_tables::UserTable;
impl std::convert::From<UserTable> for UserDetail {
fn from(user: UserTable) -> Self {
UserDetail {
id: user.id,
email: user.email,
name: user.name,
status: UserStatus::Login,
}
}
}