Files
triviathang/backend/routes/download_jobs.py
2025-12-22 14:47:25 -05:00

19 lines
603 B
Python

from flask import Blueprint, jsonify
from backend.models import DownloadJob
bp = Blueprint('download_jobs', __name__, url_prefix='/api/download-jobs')
@bp.route('/<int:job_id>', methods=['GET'])
def get_job_status(job_id):
"""Get download job status"""
job = DownloadJob.query.get_or_404(job_id)
return jsonify(job.to_dict()), 200
@bp.route('/question/<int:question_id>', methods=['GET'])
def get_job_by_question(question_id):
"""Get download job for a question"""
job = DownloadJob.query.filter_by(question_id=question_id).first_or_404()
return jsonify(job.to_dict()), 200