From 6684257bc4494cf858a9147e85330288f84f903c Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Thu, 12 Dec 2024 15:32:56 +0100
Subject: [PATCH] added job inputs/results blueprints
---
app/blueprints/jobs/__init__.py | 8 +++++++-
app/blueprints/jobs/inputs/__init__.py | 7 ++++++-
app/blueprints/jobs/inputs/routes.py | 4 ++--
app/blueprints/jobs/results/__init__.py | 7 ++++++-
app/blueprints/jobs/results/routes.py | 2 +-
5 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/app/blueprints/jobs/__init__.py b/app/blueprints/jobs/__init__.py
index 679a6fe4..08cad5f5 100644
--- a/app/blueprints/jobs/__init__.py
+++ b/app/blueprints/jobs/__init__.py
@@ -4,4 +4,10 @@ from flask import Blueprint
bp = Blueprint('jobs', __name__)
-from . import routes, inputs, results
+from . import routes
+
+from .inputs import bp as inputs_bp
+bp.register_blueprint(inputs_bp, url_prefix='//inputs')
+
+from .results import bp as results_bp
+bp.register_blueprint(results_bp, url_prefix='//results')
diff --git a/app/blueprints/jobs/inputs/__init__.py b/app/blueprints/jobs/inputs/__init__.py
index e91268cf..2ad436f4 100644
--- a/app/blueprints/jobs/inputs/__init__.py
+++ b/app/blueprints/jobs/inputs/__init__.py
@@ -1,2 +1,7 @@
-from .. import bp
+from flask import Blueprint
+
+
+bp = Blueprint('inputs', __name__)
+
+
from . import routes
diff --git a/app/blueprints/jobs/inputs/routes.py b/app/blueprints/jobs/inputs/routes.py
index f0ce4344..eb86cdae 100644
--- a/app/blueprints/jobs/inputs/routes.py
+++ b/app/blueprints/jobs/inputs/routes.py
@@ -1,10 +1,10 @@
from flask import abort, send_from_directory
from flask_login import current_user, login_required
-from app.models import JobInput
+from app.models import JobInput
from . import bp
-@bp.route('//inputs//download')
+@bp.route('//download')
@login_required
def download_job_input(job_id: int, job_input_id: int):
job_input = JobInput.query.filter_by(
diff --git a/app/blueprints/jobs/results/__init__.py b/app/blueprints/jobs/results/__init__.py
index e91268cf..45abfda6 100644
--- a/app/blueprints/jobs/results/__init__.py
+++ b/app/blueprints/jobs/results/__init__.py
@@ -1,2 +1,7 @@
-from .. import bp
+from flask import Blueprint
+
+
+bp = Blueprint('results', __name__)
+
+
from . import routes
diff --git a/app/blueprints/jobs/results/routes.py b/app/blueprints/jobs/results/routes.py
index 9b24e598..2820ed74 100644
--- a/app/blueprints/jobs/results/routes.py
+++ b/app/blueprints/jobs/results/routes.py
@@ -4,7 +4,7 @@ from app.models import JobResult
from . import bp
-@bp.route('//results//download')
+@bp.route('//download')
@login_required
def download_job_result(job_id: int, job_result_id: int):
job_result = JobResult.query.filter_by(