From 3304565d9b11c16912f32c804fdb06167b0065c7 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 14:45:39 +0000 Subject: [PATCH] Add Food model --- models/food.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 models/food.py 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