5 Commits
Author SHA1 Message Date
jakob a34898e6c1 Cosmetic: Fix indentation in cli.md 2026-09-08 12:57:52 +02:00
jakob 8e3207b139 Document v1 domain schema; clarify transaction read and import verify
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.
2026-09-02 16:38:07 +02:00
jakob 2a0bba5be7 Add web, state, and backup sections to config template
- [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
2026-09-02 11:37:04 +02:00
jakob 2b1cbb2500 Redesign CLI command structure after design review
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
2026-09-02 11:37:04 +02:00
jakob 6ea85df167 Import command wip structure plan
Copy a draft for command structure from a previous attempt at writing
this application.
2026-09-02 11:35:03 +02:00