added comodities
This commit is contained in:
21
README.md
21
README.md
@@ -4,8 +4,9 @@ A Star Citizen item catalog built from the
|
||||
[scunpacked](https://github.com/richardthombs/scunpacked) game data (mirrored at
|
||||
[StarCitizenWiki/scunpacked-data](https://github.com/StarCitizenWiki/scunpacked-data)).
|
||||
|
||||
Ships, ship equipment, and FPS items are browsable with search, manufacturer /
|
||||
type / size filters, pagination, and a detail view per item.
|
||||
Ships, ship equipment, FPS items, and cargo commodities (ores, refined metals,
|
||||
RMC, construction materials, …) are browsable with search, manufacturer / type /
|
||||
size filters, pagination, and a detail view per item.
|
||||
|
||||
Users can optionally create an account and build a **personal inventory**: items
|
||||
from the catalog are added to their own list with a quantity and notes. The
|
||||
@@ -22,8 +23,10 @@ dataset can be replaced wholesale without touching user data.
|
||||
| database | PostgreSQL 16 | Accounts, sessions, and per-user inventory rows |
|
||||
| deploy | Ansible + Podman (containers.podman) | Builds images and runs the three containers |
|
||||
|
||||
The backend image downloads the full scunpacked dataset (~83 MB) at build time,
|
||||
so the catalog needs no database — only user data does.
|
||||
The backend image downloads the full scunpacked dataset at build time, then
|
||||
reduces `items.json` to a small `commodities.json` (one entry per commodity) and
|
||||
discards the ~68 MB raw file, so the catalog needs no database — only user data
|
||||
does.
|
||||
|
||||
## Layout
|
||||
|
||||
@@ -172,7 +175,7 @@ curl -fsS -b cookies.txt http://localhost:8080/api/v1/me/inventory
|
||||
cd trade-hub/backend
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -r requirements.txt -r requirements-dev.txt
|
||||
.venv/bin/python -m pytest tests/ -q # 59 tests, no database needed
|
||||
.venv/bin/python -m pytest tests/ -q # 65 tests, no database needed
|
||||
DATA_DIR=./data/samples .venv/bin/uvicorn main:app --port 8000
|
||||
```
|
||||
|
||||
@@ -182,6 +185,11 @@ so no PostgreSQL server is required for the suite. Production uses PostgreSQL.
|
||||
- `data/samples/` — small real-schema subset for local dev/tests
|
||||
- `scripts/fetch_data.py` — downloads the full dataset (used by the Dockerfile)
|
||||
|
||||
Commodities are deduplicated to one catalog entry per name (the 1 SCU container
|
||||
variant is canonical); quantity lives on the inventory row, so 1 SCU, 8 SCU and
|
||||
32 SCU crates of the same commodity share a single entry. Refined and unrefined
|
||||
materials stay separate (`Iron` vs `Iron (Ore)`).
|
||||
|
||||
Tables are created on startup with an idempotent `create_all` and a connection
|
||||
retry loop, so a fresh volume bootstraps itself and a slow PostgreSQL start does
|
||||
not crash the backend. Additive columns for existing deployments (currently
|
||||
@@ -213,7 +221,8 @@ GET /api/v1/available?category=&search=&sort=&page=&page_size=
|
||||
|
||||
`/api/v1/me/*` requires a valid session cookie and returns `401` otherwise.
|
||||
`/api/v1/available` is public and read-only; it accepts `sort=name|category|quantity|updated`
|
||||
(default `updated`).
|
||||
(default `updated`). Catalog `category` values are `ships`, `ship-items`,
|
||||
`fps-items` and `commodities`.
|
||||
|
||||
### Configuration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user