2021-07-11 07:33:19 +00:00
|
|
|
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)]
|
2021-07-14 13:12:52 +00:00
|
|
|
pub id: String,
|
2021-07-11 07:33:19 +00:00
|
|
|
|
|
|
|
#[pb(index = 2)]
|
2021-07-14 13:12:52 +00:00
|
|
|
pub email: String,
|
2021-07-11 07:33:19 +00:00
|
|
|
|
|
|
|
#[pb(index = 3)]
|
2021-07-14 13:12:52 +00:00
|
|
|
pub name: String,
|
|
|
|
|
|
|
|
#[pb(index = 4)]
|
2021-07-11 07:33:19 +00:00
|
|
|
pub status: UserStatus,
|
|
|
|
}
|
|
|
|
|
2021-07-19 09:37:58 +00:00
|
|
|
use crate::sql_tables::UserTable;
|
|
|
|
impl std::convert::From<UserTable> for UserDetail {
|
|
|
|
fn from(user: UserTable) -> Self {
|
2021-07-11 07:33:19 +00:00
|
|
|
UserDetail {
|
2021-07-14 13:12:52 +00:00
|
|
|
id: user.id,
|
2021-07-11 07:33:19 +00:00
|
|
|
email: user.email,
|
|
|
|
name: user.name,
|
|
|
|
status: UserStatus::Login,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|