use chyabrung::prelude::*;
#[model(guarded = ["role"])]
pub struct User {
pub id: i64,
pub name: String,
pub email: String,
#[serde(skip_serializing, default)]
pub password_hash: String,
pub role: String,
pub created_at: Option<Timestamp>,
pub updated_at: Option<Timestamp>,
}
impl User {
pub fn identity(&self) -> Identity {
Identity::new(self.id.to_string()).with_name(self.name.clone()).with_role(self.role.clone())
}
}