Add Soap model
This commit is contained in:
parent
028c27e16d
commit
26e7ab0301
23
models/soap.py
Normal file
23
models/soap.py
Normal file
@ -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())
|
Loading…
x
Reference in New Issue
Block a user