Add Food model
This commit is contained in:
parent
f5da81fdc5
commit
81c3ea1c08
21
models/food.py
Normal file
21
models/food.py
Normal file
@ -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())
|
Loading…
x
Reference in New Issue
Block a user