Files
website/docs/tools-tracker.md
T

1.5 KiB

Tools tracker (/trackers/tools)

Private (owner-only, 404 for everyone else) inventory of Stan's physical tools, batteries and consumables. One row per kind of thing with a quantity (32 AAA batteries is one row).

  • Table tools.items: name (unique, case-insensitive), brand, model, category, quantity, location, purchased_on, price_eur, specs (jsonb, verified specs only), notes, timestamps.
  • Categories live in src/lib/tools/index.ts (label, colours) and are validated in code, so adding one needs no migration: batteries, power_tools, hand_tools, measuring, electrical, fasteners, consumables, safety, other.
  • Page: grouped by category with item/piece totals, search, category filter, +/- quantity buttons and an add/edit dialog (specs as key: value lines).

Adding items as a bot

On stan-ovh, from an up-to-date checkout of stan/website (e.g. ~/work/tools-tracker, git pull first; never ~/dev/personal-website):

scripts/tools-run.sh list                     # id, category, quantity, name
scripts/tools-run.sh add '{"name":"AA batteries","category":"batteries","quantity":24,"specs":{"size":"AA"}}'
scripts/tools-run.sh add '{"name":"AAA batteries","add":-4}'   # used 4 (quantity delta)
scripts/tools-run.sh import ~/imports/tools.json --dry-run     # array of entries
scripts/tools-run.sh delete 12

Entries are upserted by name (or id): only the given fields change, specs are merged (a null value removes a key), quantity sets and add changes the count. DB_URL is read from the app container and never printed.