Move the untracked 'schema draft.sql' to Documentation/schema.sql: the
agreed v1 fuel-domain schema (files, customers, batches, cards,
transactions, invoices, invoice_items), design decisions recorded in the
header: NULL-able cleartext card PINs, slim ledger projection (10 of 16
source fields, the files table is the canonical archive), string customer
business key, unified DECIMAL SEK money, full invoice traceability,
cli.md status values.
cli.md: transaction read takes <date> <receipt> -- the register's
receipt counter repeats across days (9,990 distinct receipts in the
138k-row sample), the day+receipt pair is the ledger dedup key, verified
unique in all samples. File import step 5 clarified as an internal
consistency check, since source files carry no totals of their own.
Invoice business key corrected to invoice number.
readme.md: point the database bullet at Documentation/schema.sql.
- [web]: port and public fqdn for the daemon (Caddy proxies from a
separate jail); port defaults to 8080
- [state]: daemon pidfile and logs directory, default ~/.config/rpn
- [backup]: timestamped dumps for rpnc db backup, default
~/.config/rpn/backups; rpnc db restore looks here by default
- cli.md: document the optional positional path and the directory
defaults for db backup/restore
Reframe the implementation notes as design decisions (no code exists
yet) and resolve the open design questions:
- card: contract fuel card only; retail rows carry no card
- customer delete also guards against invoices and cards
- invoice: outgoing fuel only; add explicit send (draft -> sent);
--all fans out to one invoice per customer; document statuses
- VAT: amounts stored inclusive, 25% base/VAT split at invoice time
- file import: v1 = epsilon TSV only; one DB transaction per import;
batch-total mismatch aborts with exit code 1
- file export --format raw is source-faithful; raw errors elsewhere
- batch: document derived nature; update = manual reconciliation;
list gains --from/--to/--year filters
- daemon status is local-only (no external check); pidfile/logs under
a configured state directory
- db: --force on reset/restore; timestamped backups in configured dir;
status reports migration version
- add config show, --version, --config precedence, exit-code table,
business-key ID semantics, and status values