18 lines
669 B
Python
18 lines
669 B
Python
from sqlalchemy import Column, Integer, String, Text, DateTime
|
|
from datetime import datetime, timezone
|
|
from app.database import Base
|
|
|
|
class Product(Base):
|
|
__tablename__ = "products"
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
barcode = Column(String, unique=True, index=True, nullable=False)
|
|
name = Column(String)
|
|
brand = Column(String)
|
|
category = Column(String)
|
|
ingredients_text = Column(Text)
|
|
nutri_score = Column(String)
|
|
nova_group = Column(Integer)
|
|
nutrition_json = Column(Text) # JSON string
|
|
image_url = Column(String)
|
|
updated_at = Column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
|