From 494f65a7536d62224cdb879815fb09c0a57c9607 Mon Sep 17 00:00:00 2001 From: openclaw Date: Sat, 11 Apr 2026 03:58:30 +0000 Subject: [PATCH] Add app/models/product.py --- app/models/product.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/models/product.py diff --git a/app/models/product.py b/app/models/product.py new file mode 100644 index 0000000..aa9a427 --- /dev/null +++ b/app/models/product.py @@ -0,0 +1,20 @@ +import uuid +from datetime import datetime +from sqlalchemy import Column, String, DateTime, Integer, Numeric, ForeignKey +from sqlalchemy.orm import relationship +from app.database import Base + + +class Product(Base): + __tablename__ = "products" + + id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4())) + sku = Column(String(50), unique=True, nullable=False) + name = Column(String(200), nullable=False) + description = Column(String(1000), nullable=True) + category_id = Column(String(36), ForeignKey("categories.id"), nullable=True) + price = Column(Numeric(10, 2), nullable=False) + min_stock = Column(Integer, default=0) + current_stock = Column(Integer, default=0) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)