diff --git a/app/routes/cards.py b/app/routes/cards.py index 802c275..db11aee 100644 --- a/app/routes/cards.py +++ b/app/routes/cards.py @@ -1,8 +1,8 @@ from flask import Blueprint -from ..services import cards +from ..utils import cards card_bp = Blueprint("card", __name__, "/card") -@card_bp.route("/") +@card_bp.route("/id/") def search_card(id): return cards.readCard(id) \ No newline at end of file diff --git a/app/routes/matters.py b/app/routes/matters.py index bfa13db..1edc06e 100644 --- a/app/routes/matters.py +++ b/app/routes/matters.py @@ -1,8 +1,12 @@ from flask import Blueprint -from ..services import matters +from ..utils import matters matter_bp = Blueprint("matter", __name__, "/matter") -@matter_bp.route("/") +@matter_bp.route("/id/") def search_matter(id): - return matters.readMatter(id) \ No newline at end of file + return matters.readMatter(id) + +@matter_bp.route("/match/") +def select_matter(id): + return id \ No newline at end of file diff --git a/app/routes/reactions.py b/app/routes/reactions.py index dee6fab..4579a27 100644 --- a/app/routes/reactions.py +++ b/app/routes/reactions.py @@ -1,8 +1,8 @@ from flask import Blueprint -from ..services import reactions +from ..utils import reactions reaction_bp = Blueprint("reaction", __name__, "/reaction") -@reaction_bp.route("/") +@reaction_bp.route("/id/") def search_reaction(id): return reactions.readReaction(id) \ No newline at end of file diff --git a/app/services/__init__.py b/app/services/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/services/assets.py b/app/utils/assets.py similarity index 100% rename from app/services/assets.py rename to app/utils/assets.py diff --git a/app/services/cards.py b/app/utils/cards.py similarity index 100% rename from app/services/cards.py rename to app/utils/cards.py diff --git a/app/services/matters.py b/app/utils/matters.py similarity index 53% rename from app/services/matters.py rename to app/utils/matters.py index 6f26ca2..4cac723 100644 --- a/app/services/matters.py +++ b/app/utils/matters.py @@ -7,6 +7,13 @@ def readMatterList() -> dict: return result +def readMatchList() -> dict: + with open("resources/reactions/match.json", "r", encoding="utf8") as f: + text = f.read() + result = json.loads(text) + + return result + def readMatter(id: str): path = readMatterList().get(id, -1) if (path == -1): @@ -15,4 +22,11 @@ def readMatter(id: str): text = f.read() result = json.loads(text) - return {"message": "OK", "content": result} \ No newline at end of file + return {"message": "OK", "content": result} + +def selectMatter(id: str): + matter_id = readMatchList().get(id, -1) + if (matter_id == -1): + return {"message": f"No Matter {id}"} + + return readMatter(matter_id) \ No newline at end of file diff --git a/app/services/reactions.py b/app/utils/reactions.py similarity index 100% rename from app/services/reactions.py rename to app/utils/reactions.py diff --git a/resources/reactions/match.json b/resources/reactions/match.json new file mode 100644 index 0000000..9bc2f02 --- /dev/null +++ b/resources/reactions/match.json @@ -0,0 +1,3 @@ +{ + "Carbon-Oxygen-": "CarbonDioxide" +} \ No newline at end of file