sio-2425/delivery1/server/routes/file.py

15 lines
412 B
Python

from flask import Blueprint, request, jsonify
from services import FileService
file_bp = Blueprint("file", __name__)
@file_bp.route("/get", methods=["GET"])
def file_get():
data = request.json
file_handle = data["file_handle"]
file = FileService.get_file_by_file_handle(file_handle)
if not file:
return jsonify({"error": "File not found"}), 404
return jsonify(file.to_dict()), 200