item.py 495 B

1234567891011121314151617
  1. from typing import TYPE_CHECKING
  2. from sqlalchemy import Column, ForeignKey, Integer, String, Text
  3. from sqlalchemy.orm import relationship
  4. from app.db.base_class import Base
  5. if TYPE_CHECKING:
  6. from .user import User # noqa: F401
  7. class Item(Base):
  8. id = Column(Integer, primary_key=True, index=True)
  9. title = Column(String(30), index=True)
  10. description = Column(Text)
  11. owner_id = Column(Integer, ForeignKey("user.id"))
  12. owner = relationship("User", back_populates="items")