rustio-admin-cli 0.30.0

Command-line tools for rustio-admin: project scaffolding, migrations, user management.
//! `Patient` model — the heart of your clinic admin.
//!
//! - `#[derive(RustioAdmin)]` produces the `AdminModel` impl that
//!   drives every list / form / cell rendering, AND the `impl Model`
//!   ORM contract (table, columns, row decoder, insert binder) — both
//!   from the struct fields, so there is nothing to keep in sync by
//!   hand. `#[rustio(table = "…")]` pins the SQL table name.
//! - `impl ModelAdmin for Patient { … }` opts into Django-style
//!   customisation. Override only the methods you care about; the
//!   rest inherit framework defaults.
//!
//! Rename, extend, or delete this freely — it is your project's code.

use rustio_admin::{DateTime, ModelAdmin, NaiveDate, RustioAdmin, Utc};

#[derive(RustioAdmin)]
#[rustio(table = "patients")]
pub struct Patient {
    pub id: i64,
    pub full_name: String,
    pub date_of_birth: NaiveDate,
    pub phone: String,
    pub email: String,
    pub created_at: DateTime<Utc>,
}

impl ModelAdmin for Patient {
    fn list_display() -> &'static [&'static str] {
        &["full_name", "date_of_birth", "phone", "created_at"]
    }
    fn search_fields() -> &'static [&'static str] {
        &["full_name", "phone", "email"]
    }
    fn ordering() -> &'static [&'static str] {
        &["full_name"]
    }
}