Files
dashboard/backend/models/brand.py
T

22 lines
622 B
Python
Raw Normal View History

from sqlalchemy import Column, Integer, String
from database import Base
class Brand(Base):
"""耳机品牌模型"""
__tablename__ = "brand"
__table_args__ = {"comment": "耳机品牌","extend_existing": True}
id = Column(Integer, primary_key=True, autoincrement=True, comment="品牌 ID")
name = Column(String(100), unique=True, nullable=False, comment="品牌名称")
def __repr__(self):
return f"<Brand(id={self.id}, name='{self.name}')>"
def to_dict(self):
"""Convert to dictionary"""
return {
"id": self.id,
"name": self.name
}