diff --git a/models/food.py b/models/food.py new file mode 100644 index 0000000..0f71395 --- /dev/null +++ b/models/food.py @@ -0,0 +1,21 @@ +from sqlalchemy import Column, String, Integer, Boolean, DateTime, Float, Text +from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy.sql import func +from core.database import Base +import uuid + +class Food(Base): + __tablename__ = "foods" + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + name = Column(String, nullable=False, index=True) + description = Column(Text, nullable=True) + price = Column(Float, nullable=False) + category = Column(String, nullable=False, index=True) + is_available = Column(Boolean, default=True) + calories = Column(Integer, nullable=True) + ingredients = Column(Text, nullable=True) + image_url = Column(String, nullable=True) + + created_at = Column(DateTime, default=func.now()) + updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) \ No newline at end of file