docs+data: refresh demo dumps (clean seeded state) + restore/seeder docs
- backups/procurement.dump regenerated from the clean seeded state (was the junk test data); README documents both the app seeder and the restore path - docs/casdoor-auth.md: later-batch changelog (fulfillment split, demo seeder, API-driven topics, hub-and-spoke, count modal, FOUND ceiling, semantic colors)
This commit is contained in:
@@ -201,7 +201,7 @@ docker exec -it procurement-postgres psql -U postgres -d procurement
|
|||||||
|
|
||||||
The databases are **not** in git — Docker volumes hold the data. To let
|
The databases are **not** in git — Docker volumes hold the data. To let
|
||||||
everyone see the same system state, the repo ships exact database dumps in
|
everyone see the same system state, the repo ships exact database dumps in
|
||||||
`backups/` (taken 2026-09-02). After a fresh boot:
|
`backups/`. After a fresh boot:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -File .\backups\restore.ps1 # Windows
|
powershell -ExecutionPolicy Bypass -File .\backups\restore.ps1 # Windows
|
||||||
@@ -209,16 +209,26 @@ bash backups/restore.sh # Linux / Git
|
|||||||
```
|
```
|
||||||
|
|
||||||
This **replaces all data** in the `procurement` and `casdoor` databases with
|
This **replaces all data** in the `procurement` and `casdoor` databases with
|
||||||
the committed state (users + roles, projects, warehouses, quotes with
|
the committed state — a clean, realistic demo: 3 projects × 2 warehouses,
|
||||||
receipts, inventory rows, Casdoor org/app/users). To create a fresh dump of
|
4 suppliers, 12 materials across all 8 categories, and 4 quotes covering
|
||||||
your own current state:
|
every lifecycle state (offered / in-transit / partially received /
|
||||||
|
completed) with matching stock.
|
||||||
|
|
||||||
|
Two alternative ways to get a clean state:
|
||||||
|
|
||||||
|
1. **App seeder** (realistic demo data, keeps the Casdoor org as-is):
|
||||||
```powershell
|
```powershell
|
||||||
docker compose stop api casdoor
|
docker exec procurement-api sh -c "cd /srv/backend && python -m tools.seed"
|
||||||
docker exec procurement-postgres pg_dump -U postgres -d procurement -Fc > backups/procurement.dump # (Git Bash: use -f inside the container + docker cp)
|
|
||||||
docker exec procurement-postgres pg_dump -U postgres -d casdoor -Fc > backups/casdoor.dump
|
|
||||||
docker compose start casdoor api
|
|
||||||
```
|
```
|
||||||
|
2. **Casdoor seeder** (creates org `inventory` + app + users razaei /
|
||||||
|
mousavi / mohaghegh / tester — run once after a fresh volume):
|
||||||
|
```powershell
|
||||||
|
python backend/tools/seed_casdoor.py # from the host, or from the api container
|
||||||
|
```
|
||||||
|
|
||||||
|
To create a fresh dump of your own current state: stop `api` + `casdoor`,
|
||||||
|
`docker exec procurement-postgres pg_dump -U postgres -d procurement -Fc`
|
||||||
|
(+ the `casdoor` DB) into `backups/`, then start them again.
|
||||||
|
|
||||||
## Common operations
|
## Common operations
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -235,6 +235,39 @@ After that, log in as the admin and use the Organization panel
|
|||||||
query params are dropped (previously `project_id=undefined` → 400 → empty
|
query params are dropped (previously `project_id=undefined` → 400 → empty
|
||||||
dropdowns).
|
dropdowns).
|
||||||
|
|
||||||
|
### Later batch (ledger fulfillment, demo data, hub-and-spoke)
|
||||||
|
|
||||||
|
- **Ledger fulfillment split** («رسید جزیی»): the quotation card shows a
|
||||||
|
counter badge («رسید: X از Y قلم» / «تکمیل شد» / «در راه»); each line item
|
||||||
|
visually splits into its received part (رسید شده ✓ + date + warehouse from
|
||||||
|
the receipt allocations) and the in-transit remainder — quantities always
|
||||||
|
sum to the original line (totals unchanged). Display-only split, agreed to
|
||||||
|
keep the receipt/decision chain intact.
|
||||||
|
- **Demo data seeder** (`backend/tools/seed.py`): wipes the app tables and
|
||||||
|
seeds a clean realistic dataset (3 projects × 2 warehouses, 4 suppliers,
|
||||||
|
12 materials across the 8 categories, 4 quotes in offered / in-transit /
|
||||||
|
partial / completed states with matching stock and receipts). Roles are
|
||||||
|
bound to the Casdoor users by username (run `seed_casdoor.py` first).
|
||||||
|
`backups/*.dump` are refreshed after seeding — teammates restore with
|
||||||
|
`backups/restore.ps1`.
|
||||||
|
- **Topics are API-driven**: the 8-topic grids (suppliers, wizard, units)
|
||||||
|
now come from `/material-categories` via the store instead of a hardcoded
|
||||||
|
list (which had a mismatched label «ابزار و تجهیزات ساخت»).
|
||||||
|
- **Hub-and-spoke navigation**: the tab strip lives only on «داشبورد انبار»;
|
||||||
|
sub-views (تغییر موجودی، کنترل روزانه، انبارها، کالاهای در راه، سازماندهی)
|
||||||
|
hide it and return via «بازگشت به داشبورد». «افزایش موجود» became the
|
||||||
|
«تغییر موجودی» entry button.
|
||||||
|
- **Stock count**: submission goes through a confirmation modal showing
|
||||||
|
current vs counted vs variance (کسری/مازاد) before the STOCK_COUNT
|
||||||
|
transaction is posted.
|
||||||
|
- **Found-items ceiling**: `found_qty ≤ missing balance` enforced client-side
|
||||||
|
(red input + inline warning, submit disabled) and server-side (422 with the
|
||||||
|
remaining balance); fully recovered losses drop off the pending list.
|
||||||
|
- **Semantic colors**: emerald = inflow (خرید/برگشت/پیدا شده), rose =
|
||||||
|
outflow (برداشت/ضایعات/اتلاف/مفقودی), blue = neutral (انتقال/شمارش
|
||||||
|
موجودی) across the warehouse module; quantities are shown as absolute
|
||||||
|
values with color-coded badges instead of ± signs.
|
||||||
|
|
||||||
## 9. Managing Casdoor yourself
|
## 9. Managing Casdoor yourself
|
||||||
|
|
||||||
- **Console:** http://localhost:8080 — log in as **admin / 123**. From there
|
- **Console:** http://localhost:8080 — log in as **admin / 123**. From there
|
||||||
|
|||||||
Reference in New Issue
Block a user