Spaces:
Sleeping
Sleeping
Upload app/models/notification.py
Browse files- app/models/notification.py +16 -0
app/models/notification.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime, timezone
|
| 2 |
+
|
| 3 |
+
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, JSON
|
| 4 |
+
from app.db.base import Base
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class Notification(Base):
|
| 8 |
+
__tablename__ = "notifications"
|
| 9 |
+
|
| 10 |
+
id = Column(Integer, primary_key=True, autoincrement=True)
|
| 11 |
+
type = Column(String(50), nullable=False) # checkout_shipping, checkout_payment, checkout_complete
|
| 12 |
+
title = Column(String(255), nullable=False)
|
| 13 |
+
message = Column(Text, nullable=True)
|
| 14 |
+
data = Column(JSON, nullable=True) # extra context (cart total, city, etc.)
|
| 15 |
+
is_read = Column(Boolean, default=False, nullable=False)
|
| 16 |
+
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc), nullable=False)
|