Seth0330 commited on
Commit
1fa1d42
·
verified ·
1 Parent(s): 1cfd5fd

Create product.py

Browse files
Files changed (1) hide show
  1. app/models/product.py +41 -0
app/models/product.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # models/product.py
2
+ from sqlalchemy import (
3
+ Column,
4
+ Integer,
5
+ String,
6
+ Text,
7
+ Boolean,
8
+ Numeric,
9
+ DateTime,
10
+ func,
11
+ )
12
+
13
+ from core.database import Base
14
+
15
+
16
+ class Product(Base):
17
+ __tablename__ = "products"
18
+
19
+ id = Column(Integer, primary_key=True, index=True)
20
+ name = Column(String(200), nullable=False)
21
+ price = Column(Numeric(10, 2), nullable=False)
22
+
23
+ # Stripe Payment Link URL (can be None if you haven't wired it yet)
24
+ stripe_link = Column(String(500), nullable=True)
25
+
26
+ # Optional extra fields for nicer UI
27
+ description = Column(Text, nullable=True)
28
+ image_url = Column(String(500), nullable=True)
29
+
30
+ is_active = Column(Boolean, nullable=False, default=True)
31
+
32
+ created_at = Column(
33
+ DateTime(timezone=True),
34
+ nullable=False,
35
+ server_default=func.now(),
36
+ )
37
+ updated_at = Column(
38
+ DateTime(timezone=True),
39
+ nullable=True,
40
+ onupdate=func.now(),
41
+ )