feat: initial commit — local services (backend + manager dashboard + waiter PWA)
Includes all work to date: - local_backend: FastAPI backend with products, orders, tables, shifts, cloud sync - manager_dashboard: React manager UI with product/category management, reports, settings - waiter_pwa: React PWA for waiter devices - Category reparent endpoint and UI - Waiter domain: local_ip sent on heartbeat, waiter_domain persisted from cloud response - QR code modal in AppInfoTab for waiter domain - Product form: number input spinners removed, category pre-selected on new product - Category row: count badge moved to far right Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
45
local_backend/seed.py
Normal file
45
local_backend/seed.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Run once to bootstrap the database with initial data.
|
||||
Usage: python seed.py
|
||||
"""
|
||||
import bcrypt
|
||||
from database import engine, Base, SessionLocal
|
||||
import models.user
|
||||
import models.table
|
||||
import models.printer
|
||||
import models.product
|
||||
import models.order
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
db = SessionLocal()
|
||||
|
||||
try:
|
||||
from models.user import User
|
||||
from models.printer import Printer
|
||||
|
||||
# ── Manager account ───────────────────────────────────────────────────────
|
||||
if not db.query(User).filter(User.username == "manager").first():
|
||||
db.add(User(
|
||||
username="manager",
|
||||
pin_hash=bcrypt.hashpw(b"1234", bcrypt.gensalt()).decode(),
|
||||
role="manager",
|
||||
))
|
||||
print("Created manager account (PIN: 1234)")
|
||||
else:
|
||||
print("Manager account already exists — skipping")
|
||||
|
||||
# ── Printers ──────────────────────────────────────────────────────────────
|
||||
if not db.query(Printer).filter(Printer.name == "Kitchen").first():
|
||||
db.add(Printer(name="Kitchen", ip_address="10.98.20.25", port=9100))
|
||||
print("Created Kitchen printer")
|
||||
|
||||
if not db.query(Printer).filter(Printer.name == "Bar").first():
|
||||
db.add(Printer(name="Bar", ip_address="10.98.20.25", port=9100))
|
||||
print("Created Bar printer (update IP when you have a second printer)")
|
||||
|
||||
db.commit()
|
||||
print("\nDone. Change the manager PIN after first login.")
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user