Awais
Restore original HF deployment with RAG search fallback fix
04dc214
Raw
History Blame Contribute Delete
1.28 kB
"""Bookmark model for user-saved content."""
from datetime import datetime
from sqlalchemy import Column, String, DateTime, Text, JSON
import uuid
from src.config.database import Base
class Bookmark(Base):
"""Represents a user bookmark for documentation."""
__tablename__ = "bookmarks"
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
user_id = Column(String(255), nullable=False, index=True)
content_reference = Column(String(1000), nullable=False)
title = Column(String(500), nullable=True)
notes = Column(Text, nullable=True)
location = Column(JSON, default=dict)
created_at = Column(DateTime, default=datetime.utcnow)
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
def to_dict(self) -> dict:
"""Convert model to dictionary."""
return {
"id": str(self.id),
"user_id": self.user_id,
"content_reference": self.content_reference,
"title": self.title,
"notes": self.notes,
"location": self.location,
"created_at": self.created_at.isoformat() if self.created_at else None,
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
}