20 lines
697 B
Python
20 lines
697 B
Python
from sqlalchemy import Column, Integer, String, Boolean, Text, ForeignKey, DateTime
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Notification(Base):
|
|
__tablename__ = "notifications"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
type = Column(String(50), nullable=False)
|
|
title = Column(String(200), nullable=False)
|
|
content = Column(Text, nullable=False)
|
|
is_read = Column(Boolean, default=False)
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
related_id = Column(Integer)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
|
|
user = relationship("User", back_populates="notifications") |