From c56592a218ec817d8992e5570eb7b9e558610329 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sun, 30 Mar 2025 08:33:43 +0100 Subject: [PATCH] Add Product model --- models/product.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 models/product.py diff --git a/models/product.py b/models/product.py new file mode 100644 index 0000000..cd428f4 --- /dev/null +++ b/models/product.py @@ -0,0 +1,16 @@ +from sqlalchemy import Column, String, Integer, Float, Text, DateTime +from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy.sql import func +from core.database import Base +import uuid + +class Product(Base): + __tablename__ = "products" + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + name = Column(String, nullable=False) + description = Column(Text, nullable=True) + price = Column(Float, nullable=False) + stock_quantity = Column(Integer, nullable=False) + created_at = Column(DateTime, default=func.now()) + updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) \ No newline at end of file