from sqlalchemy import Boolean, Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from app.db.base_class import Base class User(Base): email = Column(String, unique=True, index=True, nullable=False) hashed_password = Column(String, nullable=False) full_name = Column(String, index=True) is_active = Column(Boolean, default=True) is_superuser = Column(Boolean, default=False) # Relationship with Organization organization_id = Column(Integer, ForeignKey("organization.id", ondelete="CASCADE"), nullable=True) organization = relationship("Organization", back_populates="users") # Relationship with Invoice invoices = relationship("Invoice", back_populates="created_by") # Relationship with Client clients = relationship("Client", back_populates="created_by")