mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
23 lines
971 B
Python
23 lines
971 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Text
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime, timezone
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Case(Base):
|
|
__tablename__ = "cases"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
status = Column(String, default="open", nullable=False) # open, closed, investigating
|
|
severity = Column(String, nullable=True) # low, medium, high, critical
|
|
tenant_id = Column(Integer, ForeignKey("tenants.id"), nullable=False)
|
|
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
|
updated_at = Column(DateTime, default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc))
|
|
|
|
# Relationships
|
|
tenant = relationship("Tenant", back_populates="cases")
|
|
artifacts = relationship("Artifact", back_populates="case")
|