- 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>
18 lines
809 B
Python
18 lines
809 B
Python
from sqlalchemy import Float, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base, UUIDMixin, TenantMixin, TimestampMixin
|
|
|
|
|
|
class OrderLine(Base, UUIDMixin, TenantMixin, TimestampMixin):
|
|
__tablename__ = "order_lines"
|
|
order_id: Mapped[str] = mapped_column(String(36), index=True)
|
|
tip: Mapped[str] = mapped_column(String(20)) # manopera | material
|
|
descriere: Mapped[str] = mapped_column(Text)
|
|
ore: Mapped[float] = mapped_column(Float, default=0)
|
|
pret_ora: Mapped[float] = mapped_column(Float, default=0)
|
|
cantitate: Mapped[float] = mapped_column(Float, default=0)
|
|
pret_unitar: Mapped[float] = mapped_column(Float, default=0)
|
|
um: Mapped[str | None] = mapped_column(String(10))
|
|
total: Mapped[float] = mapped_column(Float, default=0)
|