Coverage for src / local_deep_research / database / models / queued_research.py: 94%
16 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-01-11 00:51 +0000
« prev ^ index » next coverage.py v7.12.0, created at 2026-01-11 00:51 +0000
1"""Queued research model for managing research queue"""
3from sqlalchemy import JSON, Boolean, Column, Integer, String
4from sqlalchemy_utc import UtcDateTime, utcnow
6from .base import Base
9class QueuedResearch(Base):
10 """Model to track queued research requests"""
12 __tablename__ = "queued_researches"
14 # Primary key
15 id = Column(Integer, primary_key=True, autoincrement=True)
17 # User and research identifiers
18 username = Column(String(100), nullable=False, index=True)
19 research_id = Column(String(36), nullable=False, unique=True) # UUID
21 # Research parameters
22 query = Column(String(1000), nullable=False)
23 mode = Column(String(50), nullable=False)
24 settings_snapshot = Column(JSON) # All research settings
26 # Queue metadata
27 position = Column(Integer, nullable=False) # Position in queue
28 created_at = Column(UtcDateTime, server_default=utcnow())
30 # Status
31 is_processing = Column(Boolean, default=False) # Being processed
33 def __repr__(self):
34 return f"<QueuedResearch(username={self.username}, research_id={self.research_id}, position={self.position})>"