Demo auth, seed import/reset, dashboard, vehicle/booking list+detail, audit trail. Backend: 19 tests passing, ruff clean. Frontend: React Router shell, typed API client, responsive pages. Verified end-to-end via curl and browser.
36 lines
975 B
Python
36 lines
975 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from app.core.db import SessionLocal
|
|
from app.seed_loader import reset_and_seed
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(prog="app.cli")
|
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
|
|
seed_parser = subparsers.add_parser("seed", help="Load the deterministic demo dataset")
|
|
seed_parser.add_argument(
|
|
"--reset", action="store_true", help="Clear existing data before loading"
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
if args.command == "seed":
|
|
if not args.reset:
|
|
raise SystemExit(
|
|
"Only 'seed --reset' is supported: seeding always rebuilds the demo dataset."
|
|
)
|
|
db = SessionLocal()
|
|
try:
|
|
result = reset_and_seed(db)
|
|
for name, count in result.counts.items():
|
|
print(f"{name}: {count}")
|
|
finally:
|
|
db.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|