init
This commit is contained in:
@@ -3,5 +3,6 @@ from app.models.calculation import Calculation
|
||||
from app.models.order import Order
|
||||
from app.models.admin_user import AdminUser
|
||||
from app.models.app_settings import AppSettings
|
||||
from app.models.client import Client
|
||||
|
||||
__all__ = ["Material", "Calculation", "Order", "AdminUser", "AppSettings"]
|
||||
__all__ = ["Material", "Calculation", "Order", "AdminUser", "AppSettings", "Client"]
|
||||
|
||||
18
backend/app/models/client.py
Normal file
18
backend/app/models/client.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from sqlalchemy import Boolean, Integer, String, Text, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from datetime import datetime
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class Client(Base):
|
||||
__tablename__ = "clients"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
email: Mapped[str] = mapped_column(String(200), unique=True, nullable=False)
|
||||
password_hash: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
name: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
phone: Mapped[str | None] = mapped_column(String(20))
|
||||
company: Mapped[str | None] = mapped_column(String(200))
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
created_at: Mapped[datetime] = mapped_column(default=func.now())
|
||||
@@ -13,6 +13,7 @@ class Order(Base):
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
order_id: Mapped[str] = mapped_column(String(20), unique=True, nullable=False)
|
||||
calculation_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("calculations.id"), nullable=False)
|
||||
client_id: Mapped[int | None] = mapped_column(Integer, ForeignKey("clients.id"))
|
||||
client_name: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
client_phone: Mapped[str] = mapped_column(String(20), nullable=False)
|
||||
client_email: Mapped[str | None] = mapped_column(String(200))
|
||||
|
||||
Reference in New Issue
Block a user