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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::models::User;
use chyabrung::prelude::*;

#[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,
        })
    }
}