Files
zeekay a460b86bef Quotewright Proposals — line-item proposals with a shareable read-only link
Real Hanzo-stack app (Vite + React 19 + @hanzo/gui + @hanzo/iam + @hanzo/base), forked from hanzo-starter with identical provider stack, vite.config, PKCE auth, and deploy contract. Three @hanzo/gui views (proposals list, editor with live totals sidebar, invoice-like preview) over org-scoped proposals + lineitems in Base. tsc --noEmit + vite build green; renders with zero console errors.
2026-07-21 13:25:26 -07:00

31 lines
1.1 KiB
SQL

-- Hanzo Base schema for Quotewright (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`.
--
-- Both collections are ORG-SCOPED. The list/view/create/update/delete rules
-- Hanzo Cloud provisions are, for every collection below:
--
-- @request.auth.org_id = org
--
-- so a teammate in your org reads/writes the row and other orgs cannot see it.
-- A `lineitems.proposal` is the parent proposal's Base `id`.
--
-- Keep this file in lockstep with what the app reads/writes
-- (src/views/editor.tsx · list.tsx · preview.tsx; src/lib/proposal.ts).
CREATE TABLE IF NOT EXISTS proposals (
client TEXT NOT NULL DEFAULT '',
title TEXT NOT NULL DEFAULT 'Untitled proposal',
status TEXT NOT NULL DEFAULT 'draft'
);
CREATE TABLE IF NOT EXISTS lineitems (
proposal TEXT NOT NULL,
desc TEXT NOT NULL DEFAULT '',
qty REAL NOT NULL DEFAULT 1,
price REAL NOT NULL DEFAULT 0
);