mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
24 lines
919 B
Python
24 lines
919 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean, Text
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime, timezone
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Notification(Base):
|
|
__tablename__ = "notifications"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
tenant_id = Column(Integer, ForeignKey("tenants.id"), nullable=False)
|
|
title = Column(String, nullable=False)
|
|
message = Column(Text, nullable=False)
|
|
notification_type = Column(String, nullable=False) # info, warning, error, success
|
|
is_read = Column(Boolean, default=False, nullable=False)
|
|
link = Column(String, nullable=True)
|
|
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc), index=True)
|
|
|
|
# Relationships
|
|
user = relationship("User")
|
|
tenant = relationship("Tenant")
|