From 26e7ab03013b8b1a6eb5e28a9d4065f0be4c871b Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 13:31:48 +0000 Subject: [PATCH] Add Soap model --- models/soap.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 models/soap.py diff --git a/models/soap.py b/models/soap.py new file mode 100644 index 0000000..8d38307 --- /dev/null +++ b/models/soap.py @@ -0,0 +1,23 @@ +from sqlalchemy import Column, String, Integer, Boolean, DateTime, ForeignKey, Numeric +from sqlalchemy.orm import relationship +from sqlalchemy.sql import func +from core.database import Base +import uuid + +class Soap(Base): + __tablename__ = "soaps" + + id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) + name = Column(String, nullable=False, index=True) + brand = Column(String, nullable=False) + description = Column(String) + price = Column(Numeric(10, 2), nullable=False) + weight = Column(Numeric(10, 2)) + ingredients = Column(String) + stock_quantity = Column(Integer, default=0) + is_available = Column(Boolean, default=True) + fragrance = Column(String) + type = Column(String) + + created_at = Column(DateTime, default=func.now()) + updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) \ No newline at end of file