pounce/backend/app/models/zone_file.py
Yves Gugger c5abba5d2f
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
feat: award-winning hunt tabs + .ch/.li zone file drops
2025-12-15 21:45:42 +01:00

44 lines
1.5 KiB
Python

"""
Zone File Models for .ch and .li domain drops
"""
from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, Boolean, Index
from app.database import Base
class ZoneSnapshot(Base):
"""Stores metadata about zone file snapshots (not the full data)"""
__tablename__ = "zone_snapshots"
id = Column(Integer, primary_key=True)
tld = Column(String(10), nullable=False, index=True) # 'ch' or 'li'
snapshot_date = Column(DateTime, nullable=False, index=True)
domain_count = Column(Integer, nullable=False)
checksum = Column(String(64), nullable=False) # SHA256 of sorted domain list
created_at = Column(DateTime, default=datetime.utcnow)
__table_args__ = (
Index('ix_zone_snapshots_tld_date', 'tld', 'snapshot_date'),
)
class DroppedDomain(Base):
"""Stores domains that were dropped (found in previous snapshot but not current)"""
__tablename__ = "dropped_domains"
id = Column(Integer, primary_key=True)
domain = Column(String(255), nullable=False, index=True)
tld = Column(String(10), nullable=False, index=True)
dropped_date = Column(DateTime, nullable=False, index=True)
length = Column(Integer, nullable=False)
is_numeric = Column(Boolean, default=False)
has_hyphen = Column(Boolean, default=False)
created_at = Column(DateTime, default=datetime.utcnow)
__table_args__ = (
Index('ix_dropped_domains_tld_date', 'tld', 'dropped_date'),
Index('ix_dropped_domains_length', 'length'),
)