from flask import render_template, Blueprint, jsonify
from app.models.topic import Topic

bp = Blueprint('debug', __name__)

@bp.route('/debug/topics')
def debug_topics():
    """Debug view to see all topics in the database"""
    topics = Topic.query.all()
    topics_data = []
    for topic in topics:
        topics_data.append({
            'id': topic.id,
            'title': topic.title,
            'section_title': topic.section_title,
            'course_id': topic.course_id,
            'course_type': topic.course_type,
            'order': topic.order
        })
    return jsonify(topics=topics_data)