mirror of
https://github.com/hanzo-apps/expense-spend.git
synced 2026-10-30 19:17:00 +00:00
Real Hanzo-stack app forked from hanzo-starter — Vite + React 19 + @hanzo/gui + @hanzo/iam (PKCE) + @hanzo/base. Three views (expense log, add expense, spend summary) over an org-scoped `expenses` collection provisioned from schema.sql. 100% @hanzo/gui primitives (longhand props), clean fintech surface with category chips and by-category / by-month charts. tsc + vite build green.
20 lines
1.0 KiB
SQL
20 lines
1.0 KiB
SQL
-- Hanzo Base schema for Expense Spend (the `databaseSchema` DDL).
|
|
--
|
|
-- On publish, Hanzo Cloud translates each CREATE TABLE into a Hanzo Base
|
|
-- collection via `provisionBaseFromDDL` (additive + idempotent). Base manages
|
|
-- `id`/`created`/`updated`/`owner`/`org` itself, so they are never re-declared
|
|
-- here; every row is stamped with the verified IAM `owner`+`org` and is
|
|
-- org-scoped — the collection's access rule is `@request.auth.org_id = org`, so
|
|
-- a member of your org reads/writes it and other orgs cannot see it.
|
|
--
|
|
-- Keep this file in lockstep with what the app reads/writes
|
|
-- (src/lib/expense.ts, src/views/log.tsx, src/views/summary.tsx).
|
|
|
|
CREATE TABLE IF NOT EXISTS expenses (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
amount REAL NOT NULL, -- spend amount, e.g. 12.50
|
|
category TEXT NOT NULL, -- category id: food | transport | housing | shopping | health | fun | bills | other
|
|
note TEXT, -- optional free-text memo
|
|
date TEXT NOT NULL -- yyyy-mm-dd the money was spent
|
|
);
|