ipwatch
This commit is contained in:
25
backend/app/models/scan_log.py
Normal file
25
backend/app/models/scan_log.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
Historique détaillé des scans (logs par IP)
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Index
|
||||
from datetime import datetime
|
||||
from backend.app.core.database import Base
|
||||
|
||||
|
||||
class ScanLog(Base):
|
||||
"""
|
||||
Table de logs des scans réseau
|
||||
"""
|
||||
__tablename__ = "scan_log"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
ip = Column(String, index=True, nullable=True)
|
||||
status = Column(String, nullable=True)
|
||||
message = Column(String, nullable=False)
|
||||
created_at = Column(DateTime, default=datetime.now, index=True, nullable=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ScanLog {self.id} {self.ip} {self.status}>"
|
||||
|
||||
|
||||
Index('idx_scan_log_created_at', ScanLog.created_at)
|
||||
Reference in New Issue
Block a user