chyabrung-cli 0.2.5

The `chy` command line tool for Chyabrung: scaffolding, dev server with hot reload, builds, generators, migrations and one-command deploys
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())
    }
}