From 6025a4a6065044352f836dd52edead08ba18505b Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Sat, 4 May 2024 15:14:21 +0200
Subject: [PATCH] add API back
---
app/__init__.py | 16 ++++++++--------
app/templates/_base/sidenav.html.j2 | 4 ++--
requirements.freezed.txt | 5 +++--
requirements.txt | 6 +++---
4 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/app/__init__.py b/app/__init__.py
index b70fbf35..09c78f2a 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -1,4 +1,4 @@
-# from apifairy import APIFairy
+from apifairy import APIFairy
from config import Config
from docker import DockerClient
from flask import Flask
@@ -6,7 +6,7 @@ from flask_apscheduler import APScheduler
from flask_assets import Environment
from flask_login import LoginManager
from flask_mail import Mail
-# from flask_marshmallow import Marshmallow
+from flask_marshmallow import Marshmallow
from flask_migrate import Migrate
from flask_paranoid import Paranoid
from flask_socketio import SocketIO
@@ -14,7 +14,7 @@ from flask_sqlalchemy import SQLAlchemy
from flask_hashids import Hashids
-# apifairy = APIFairy()
+apifairy = APIFairy()
assets = Environment()
db = SQLAlchemy()
docker_client = DockerClient()
@@ -22,7 +22,7 @@ hashids = Hashids()
login = LoginManager()
login.login_view = 'auth.login'
login.login_message = 'Please log in to access this page.'
-# ma = Marshmallow()
+ma = Marshmallow()
mail = Mail()
migrate = Migrate(compare_type=True)
paranoid = Paranoid()
@@ -45,12 +45,12 @@ def create_app(config: Config = Config) -> Flask:
registry=app.config['NOPAQUE_DOCKER_REGISTRY']
)
- # apifairy.init_app(app)
+ apifairy.init_app(app)
assets.init_app(app)
db.init_app(app)
hashids.init_app(app)
login.init_app(app)
- # ma.init_app(app)
+ ma.init_app(app)
mail.init_app(app)
migrate.init_app(app, db)
paranoid.init_app(app)
@@ -63,8 +63,8 @@ def create_app(config: Config = Config) -> Flask:
from .admin import bp as admin_blueprint
app.register_blueprint(admin_blueprint, url_prefix='/admin')
- # from .api import bp as api_blueprint
- # app.register_blueprint(api_blueprint, url_prefix='/api')
+ from .api import bp as api_blueprint
+ app.register_blueprint(api_blueprint, url_prefix='/api')
from .auth import bp as auth_blueprint
app.register_blueprint(auth_blueprint)
diff --git a/app/templates/_base/sidenav.html.j2 b/app/templates/_base/sidenav.html.j2
index c5dedec0..784f1ab0 100644
--- a/app/templates/_base/sidenav.html.j2
+++ b/app/templates/_base/sidenav.html.j2
@@ -11,11 +11,11 @@
{# general items #}
- {# {% if current_user.can('USE_API') %}
+ {% if current_user.can('USE_API') %}
apiAPI
- {% endif %} #}
+ {% endif %}
schoolManual
diff --git a/requirements.freezed.txt b/requirements.freezed.txt
index e1427633..a5c2daa4 100644
--- a/requirements.freezed.txt
+++ b/requirements.freezed.txt
@@ -20,7 +20,7 @@ Flask-Hashids==1.0.3
Flask-HTTPAuth==4.8.0
Flask-Login==0.6.3
Flask-Mail==0.9.1
-flask-marshmallow==1.2.1
+flask-marshmallow==0.14.0
Flask-Migrate==4.0.7
Flask-Paranoid==0.3.0
Flask-SocketIO==5.3.6
@@ -36,6 +36,7 @@ joblib==1.4.0
Mako==1.3.3
MarkupSafe==2.1.5
marshmallow==3.21.1
+marshmallow-sqlalchemy==1.0.0
nltk==3.8.1
packaging==24.0
psycopg2==2.9.9
@@ -53,7 +54,7 @@ requests==2.31.0
simple-websocket==1.0.0
six==1.16.0
SQLAlchemy==1.4.52
-tqdm==4.66.2
+tqdm==4.66.4
typing_extensions==4.11.0
tzlocal==5.2
urllib3==2.2.1
diff --git a/requirements.txt b/requirements.txt
index 886edd31..71c7daaa 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,16 +7,16 @@ Flask==2.3.3
Flask-APScheduler
Flask-Assets
Flask-Hashids
-# Flask-HTTPAuth
+Flask-HTTPAuth
Flask-Login
Flask-Mail
-# flask-marshmallow
+flask-marshmallow==0.14.0
Flask-Migrate
Flask-Paranoid
Flask-SocketIO
Flask-SQLAlchemy==2.5.1
Flask-WTF
-# marshmallow-sqlalchemy
+marshmallow-sqlalchemy
nltk
psycopg2
PyJWT