- 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>
30 lines
986 B
Python
30 lines
986 B
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import Column, Integer, String, DateTime
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
name = Column(String, nullable=False)
|
|
role = Column(String, default="user") # admin, moderator, user
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
|
|
documents = relationship("PDFDocument", back_populates="user")
|
|
quizzes = relationship("Quiz", back_populates="user")
|
|
attempts = relationship("QuizAttempt", back_populates="user")
|
|
reminders = relationship("ReminderSchedule", back_populates="user")
|
|
|
|
@property
|
|
def is_admin(self):
|
|
return self.role == "admin"
|
|
|
|
@property
|
|
def is_moderator(self):
|
|
return self.role in ("admin", "moderator")
|