
- User authentication with JWT tokens (register/login) - Tutor session management with CRUD operations - Message tracking for tutor conversations - SQLite database with Alembic migrations - CORS configuration for frontend integration - Health check and service info endpoints - Proper project structure with models, schemas, and API routes
20 lines
842 B
Python
20 lines
842 B
Python
from sqlalchemy import Column, Integer, String, DateTime, Text, ForeignKey
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
from app.db.base import Base
|
|
|
|
|
|
class TutorSession(Base):
|
|
__tablename__ = "tutor_sessions"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
subject = Column(String, nullable=False)
|
|
topic = Column(String, nullable=True)
|
|
difficulty_level = Column(String, nullable=True)
|
|
session_status = Column(String, default="active")
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
user = relationship("User", back_populates="tutor_sessions")
|
|
messages = relationship("TutorMessage", back_populates="session") |