20 lines
700 B
Python
20 lines
700 B
Python
from sqlalchemy import Boolean, Column, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.session import Base
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
username = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
full_name = Column(String)
|
|
is_active = Column(Boolean, default=True)
|
|
is_superuser = Column(Boolean, default=False)
|
|
|
|
# Relationships
|
|
orders = relationship("Order", back_populates="user")
|
|
shipments = relationship("Shipment", back_populates="created_by") |