feat(backend): sync endpoints + all models + seed + order workflow

- All business models: Vehicle, Order, OrderLine, Invoice, Appointment,
  CatalogMarca/Model/Ansamblu/Norma/Pret/TipDeviz/TipMotor, Mecanic
- Sync endpoints: GET /sync/full, GET /sync/changes?since=, POST /sync/push
  with tenant isolation and last-write-wins conflict resolution
- Order CRUD with state machine: DRAFT -> VALIDAT -> FACTURAT
  Auto-recalculates totals (manopera + materiale)
- Vehicle CRUD: list, create, get, update
- Seed data: 24 marci, 11 ansamble, 6 tipuri deviz, 5 tipuri motoare, 3 preturi
- Alembic migration for all business models
- 13 passing tests (auth + sync + orders)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 17:31:02 +02:00
parent ad41956ea1
commit 3a922a50e6
25 changed files with 1410 additions and 1 deletions

View File

@@ -7,6 +7,9 @@ from app.auth.router import router as auth_router
from app.config import settings
from app.db.base import Base
from app.db.session import engine
from app.orders.router import router as orders_router
from app.sync.router import router as sync_router
from app.vehicles.router import router as vehicles_router
# Import models so Base.metadata knows about them
import app.db.models # noqa: F401
@@ -28,6 +31,9 @@ app.add_middleware(
allow_credentials=True,
)
app.include_router(auth_router, prefix="/api/auth")
app.include_router(sync_router, prefix="/api/sync")
app.include_router(orders_router, prefix="/api/orders")
app.include_router(vehicles_router, prefix="/api/vehicles")
@app.get("/api/health")