2024-11-13 02:49:43 +00:00
|
|
|
from flask import Blueprint, request, jsonify
|
|
|
|
from services import FileService
|
|
|
|
|
|
|
|
file_bp = Blueprint("file", __name__)
|
2024-11-16 22:59:54 +00:00
|
|
|
|
|
|
|
@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
|
|
|
|
|