23 lines
922 B
Python
23 lines
922 B
Python
"""ip_registry table (Chapter 06 + Chapter 07 extension).
|
|
|
|
last_verified_bot_result: NOT in Ch06's literal column list — added in
|
|
Chapter 07. last_verified_at alone can't tell a cache hit *what* was
|
|
verified, only *when*; this stores the outcome.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from app.extensions import db
|
|
|
|
|
|
class IPRegistry(db.Model):
|
|
__tablename__ = "ip_registry"
|
|
|
|
ip: str = db.Column(db.String(45), primary_key=True)
|
|
first_seen = db.Column(db.DateTime, nullable=False)
|
|
last_seen = db.Column(db.DateTime, nullable=False)
|
|
total_requests: int = db.Column(db.Integer, nullable=False, default=0)
|
|
reputation_score: int = db.Column(db.Integer, nullable=False, default=0)
|
|
is_flagged: bool = db.Column(db.Boolean, nullable=False, default=False)
|
|
last_verified_at = db.Column(db.DateTime, nullable=True)
|
|
last_verified_bot_result: bool | None = db.Column(db.Boolean, nullable=True)
|