From 58b6a527eb390607c786ab9da4effaf69532cbd4 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Sun, 28 Apr 2024 15:25:01 +1000 Subject: [PATCH] Added DB schema notes Compressed imports Added api blueprint --- src/db.py | 15 +++++++++++++++ src/flask_app.py | 3 ++- src/routes/api.py | 13 +++++++++++++ src/routes/root.py | 3 +-- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 src/routes/api.py diff --git a/src/db.py b/src/db.py index 352df20..36fc0aa 100644 --- a/src/db.py +++ b/src/db.py @@ -1,5 +1,20 @@ import sqlite3 +# tables +# manga +# chapters_downloaded + +# Schema - manga +# id +# uuid +# title +# thumbnail + +# Schema - chapters_downloaded +# id +# chapter_number +# manga_id + class DB: def __init__(self, path): diff --git a/src/flask_app.py b/src/flask_app.py index 31cf991..8a12c1d 100644 --- a/src/flask_app.py +++ b/src/flask_app.py @@ -1,4 +1,4 @@ -from routes import root +from routes import root, api from flask import Flask from os.path import expanduser @@ -15,3 +15,4 @@ class App(Flask): def register_blueprints(self): self.register_blueprint(root.bp) + self.register_blueprint(api.bp) diff --git a/src/routes/api.py b/src/routes/api.py new file mode 100644 index 0000000..e69ac6e --- /dev/null +++ b/src/routes/api.py @@ -0,0 +1,13 @@ +from flask import Blueprint, current_app + +bp = Blueprint("api", __name__, url_prefix="/api") + + +@bp.route("/") +def root(): + return current_app.name + + +@bp.route("/test") +def test(): + return {"this works": "How I Expected"} diff --git a/src/routes/root.py b/src/routes/root.py index 27585b1..7c44b46 100644 --- a/src/routes/root.py +++ b/src/routes/root.py @@ -1,5 +1,4 @@ -from flask import Blueprint -from flask import current_app +from flask import Blueprint, current_app bp = Blueprint("root", __name__, url_prefix="/")