c1638db6b2
- Save every search result to DB for later review - Add '搜索历史' tab with timeline view, load/delete records - Raise discovery search timeout from 30s to 120s (Bing Puppeteer needs ~40s) - Reduce search queries from 4 to 3 for faster response - New model: DiscoveryRecord (user_id, product, market, companies JSON) - API: POST/GET/DELETE /api/v1/discovery/records - Migration: discovery_records table
17 lines
592 B
Python
17 lines
592 B
Python
from sqlalchemy import Column, String, DateTime, Text
|
|
from sqlalchemy.dialects.postgresql import UUID, JSONB
|
|
from datetime import datetime
|
|
from app.database import Base
|
|
import uuid
|
|
|
|
|
|
class DiscoveryRecord(Base):
|
|
__tablename__ = "discovery_records"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
user_id = Column(UUID(as_uuid=True), nullable=False, index=True)
|
|
product = Column(String(500), nullable=False)
|
|
market = Column(String(200), default="")
|
|
companies = Column(JSONB, default=[])
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|