21 lines
556 B
Python

from sqlalchemy import Column, String, Text
from sqlalchemy.orm import relationship
from app.models.base import Base
from app.models.product import product_category
class Category(Base):
"""Model for anime merchandise categories."""
name = Column(String(100), nullable=False, unique=True, index=True)
description = Column(Text, nullable=True)
# Relationships
products = relationship(
"Product", secondary=product_category, back_populates="categories"
)
def __repr__(self):
return f"<Category {self.name}>"