chyabrung-cli 0.2.4

The `chy` command line tool for Chyabrung: scaffolding, dev server with hot reload, builds, generators, migrations and one-command deploys
use crate::models::User;
use chyabrung::prelude::*;

/// How a user looks in the API. The password hash is simply not listed, so it
/// can never be sent.
#[resource(User)]
pub struct UserResource;

impl JsonResource for UserResource {
    fn to_array(&self) -> JsonValue {
        json!({
            "id": self.id,
            "name": self.name,
            "email": self.email,
            "role": self.role,
            "joined_at": self.created_at,
        })
    }
}