Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions app_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,51 @@ def get_user_resumes(user_id):
return jsonify({"error": "INTERNAL_ERROR", "message": str(e)}), 500


@app.route("/api/v1/user/resumes/download/<resume_id>", methods=["GET"])
def download_resume(resume_id):
"""Download a previously generated resume PDF"""
try:
from database.repositories import ResumeRepository
resume = ResumeRepository.get_resume(resume_id)
if not resume or not resume.pdf_path:
return jsonify({"error": "Resume not found"}), 404

if not os.path.exists(resume.pdf_path):
return jsonify({"error": "PDF file not found on server"}), 404

return send_file(
resume.pdf_path,
mimetype="application/pdf",
as_attachment=True,
download_name=f"resume_{resume.job_title.replace(' ', '_')}.pdf"
)
except Exception as e:
logger.error(f"Failed to download resume: {e}", exc_info=True)
return jsonify({"error": "INTERNAL_ERROR", "message": str(e)}), 500


@app.route("/api/v1/user/resumes/preview/<resume_id>", methods=["GET"])
def preview_resume(resume_id):
"""Preview a previously generated resume PDF inline"""
try:
from database.repositories import ResumeRepository
resume = ResumeRepository.get_resume(resume_id)
if not resume or not resume.pdf_path:
return jsonify({"error": "Resume not found"}), 404

if not os.path.exists(resume.pdf_path):
return jsonify({"error": "PDF file not found on server"}), 404

return send_file(
resume.pdf_path,
mimetype="application/pdf",
as_attachment=False
)
except Exception as e:
logger.error(f"Failed to preview resume: {e}", exc_info=True)
return jsonify({"error": "INTERNAL_ERROR", "message": str(e)}), 500


@app.route("/api/v1/user/applications/<user_id>", methods=["GET"])
def get_user_applications(user_id):
"""Get all job applications for a user"""
Expand Down