sanbon / app /models /product.py
Seth0330's picture
Create product.py
1fa1d42 verified
# models/product.py
from sqlalchemy import (
Column,
Integer,
String,
Text,
Boolean,
Numeric,
DateTime,
func,
)
from core.database import Base
class Product(Base):
__tablename__ = "products"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(200), nullable=False)
price = Column(Numeric(10, 2), nullable=False)
# Stripe Payment Link URL (can be None if you haven't wired it yet)
stripe_link = Column(String(500), nullable=True)
# Optional extra fields for nicer UI
description = Column(Text, nullable=True)
image_url = Column(String(500), nullable=True)
is_active = Column(Boolean, nullable=False, default=True)
created_at = Column(
DateTime(timezone=True),
nullable=False,
server_default=func.now(),
)
updated_at = Column(
DateTime(timezone=True),
nullable=True,
onupdate=func.now(),
)