- FastAPI backend with JWT auth, roles (admin/moderator/user) - PDF upload (up to 500MB) with streaming, PyMuPDF text extraction - ChromaDB vectorization per page with metadata - LiteLLM AI question extraction from PDF (not generation) - Image extraction from PDF pages, graceful fallback - Quiz modes: timed (countdown timer) + learning (answers shown inline) - Page-by-page question navigation with dot navigator - TTS endpoint using LiteLLM (Google Vertex / OpenAI voices) - Admin dashboard: AI model management per task, user role management - Moderator role: upload PDFs, create sections, generate quizzes - Spaced repetition reminders via SMTP email (SM-2 intervals) - APScheduler daily reminder jobs - Celery + Redis for background PDF processing - React frontend with all pages - Docker Compose deployment (nginx + backend + celery + redis) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
855 B
Python
22 lines
855 B
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class PDFDocument(Base):
|
|
__tablename__ = "pdf_documents"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
filename = Column(String, nullable=False)
|
|
original_filename = Column(String, nullable=False)
|
|
total_pages = Column(Integer, nullable=True)
|
|
status = Column(String, default="processing") # processing, ready, error
|
|
error_message = Column(String, nullable=True)
|
|
uploaded_at = Column(DateTime, default=datetime.utcnow)
|
|
|
|
user = relationship("User", back_populates="documents")
|
|
sections = relationship("Section", back_populates="document", cascade="all, delete-orphan")
|