Skip to content

Commit

Permalink
Merge branch 'Bilgecrank:development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
vtestagrossa authored Feb 13, 2024
2 parents c79ccbf + a64670d commit 0c214f5
Show file tree
Hide file tree
Showing 19 changed files with 398 additions and 129 deletions.
176 changes: 176 additions & 0 deletions .diagrams/backend-inheritance.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<mxfile host="app.diagrams.net" modified="2024-02-11T19:56:18.954Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" etag="UhBSb376qlTZVYUAoS33" version="23.1.1" type="github">
<diagram name="Page-1" id="804swjDIFLC3ij7y9A-g">
<mxGraphModel dx="633" dy="782" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-13" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-1" target="Dt7J_ap_PFdbIPsA8fPm-6" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="245" y="230" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-28" value="db" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-13" vertex="1" connectable="0">
<mxGeometry x="0.1091" y="4" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-14" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-1" target="Dt7J_ap_PFdbIPsA8fPm-8" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="200" y="250" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_2fDIvIG2nEXkmLHzcHr-1" value="login_manager" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" vertex="1" connectable="0" parent="Dt7J_ap_PFdbIPsA8fPm-14">
<mxGeometry x="0.2907" y="9" relative="1" as="geometry">
<mxPoint x="-13" y="35" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-15" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-1" target="Dt7J_ap_PFdbIPsA8fPm-2" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="110" y="290" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-30" value="app" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-15" vertex="1" connectable="0">
<mxGeometry x="0.0669" y="20" relative="1" as="geometry">
<mxPoint y="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-16" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-1" target="Dt7J_ap_PFdbIPsA8fPm-5" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="280" y="200" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-27" value="db" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-16" vertex="1" connectable="0">
<mxGeometry x="0.1486" y="4" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-17" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-1" target="Dt7J_ap_PFdbIPsA8fPm-4" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="320" y="160" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-26" value="db" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-17" vertex="1" connectable="0">
<mxGeometry x="0.1075" y="8" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-18" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-1" target="Dt7J_ap_PFdbIPsA8fPm-3" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="220" y="100" as="targetPoint" />
<Array as="points">
<mxPoint x="160" y="120" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-25" value="app" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-18" vertex="1" connectable="0">
<mxGeometry x="0.0217" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-1" value="db_setup.py" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="170" y="20" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-2" value="routes.py" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="80" y="460" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-3" value="main.py" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="30" y="130" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-19" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-4" target="Dt7J_ap_PFdbIPsA8fPm-5" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="420" y="240" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-31" value="Table Models" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-19" vertex="1" connectable="0">
<mxGeometry x="-0.0373" y="-3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-20" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-4" target="Dt7J_ap_PFdbIPsA8fPm-6" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="540" y="350" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-33" value="Table Models" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-20" vertex="1" connectable="0">
<mxGeometry x="-0.3984" y="-27" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-4" value="/tables" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="400" y="80" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-22" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-5" target="Dt7J_ap_PFdbIPsA8fPm-6" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="370" y="330" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-35" value="import" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-22" vertex="1" connectable="0">
<mxGeometry x="-0.2089" y="-6" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-23" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;exitX=1;exitY=1;exitDx=0;exitDy=0;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-5" target="Dt7J_ap_PFdbIPsA8fPm-8" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="420" y="460" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-34" value="import" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-23" vertex="1" connectable="0">
<mxGeometry x="-0.2227" y="-23" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-5" value="sql_query.py" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="300" y="240" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-21" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-6" target="Dt7J_ap_PFdbIPsA8fPm-8" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="350" y="410" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-37" value="import" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-21" vertex="1" connectable="0">
<mxGeometry x="-0.5001" y="-5" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-6" value="sql_update.py" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="230" y="330" width="110" height="40" as="geometry" />
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-24" style="edgeStyle=none;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=12;startSize=8;endSize=8;" parent="1" source="Dt7J_ap_PFdbIPsA8fPm-8" target="Dt7J_ap_PFdbIPsA8fPm-2" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="270" y="500" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-36" value="import" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=16;" parent="Dt7J_ap_PFdbIPsA8fPm-24" vertex="1" connectable="0">
<mxGeometry x="0.3032" y="-12" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Dt7J_ap_PFdbIPsA8fPm-8" value="authenticate.py" style="rounded=0;whiteSpace=wrap;html=1;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="160" y="395" width="130" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ __pycache__/
*.py[cod]
*$py.class

# C extensions
# C extensions.py
*.so

# Distribution / packaging
Expand Down Expand Up @@ -161,4 +161,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/workspace.xml
53 changes: 41 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions hindsite/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Inits variables for the application
"""
import os
from dotenv import load_dotenv
from flask import Flask
from hindsite.db_setup import Base
from hindsite.extensions import db, login_manager

load_dotenv()
database_uri = ("mysql+pymysql://"
+ os.environ['MYSQLUSER'] + ":"
+ os.environ['MYSQL_ROOT_PASSWORD'] + "@"
+ os.environ['MYSQLHOST'] + ":"
+ os.environ['MYSQLPORT'] + "/"
+ os.environ['MYSQL_DATABASE'])

app = Flask(__name__)
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] # Session secret key
app.config['SQLALCHEMY_DATABASE_URI'] = database_uri
app.config['SQLALCHEMY_TRACK_NOTIFICATIONS'] = False

login_manager.init_app(app)
db.Model = Base
db.init_app(app)
from hindsite.routes import routes # pylint disable=wrong-import-position
app.register_blueprint(routes)
16 changes: 12 additions & 4 deletions hindsite/authenticate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import bcrypt
import flask_login

from hindsite.db_setup import app
from hindsite.extensions import login_manager
import hindsite.sql_query as query
import hindsite.sql_update as update


login_manager = flask_login.LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'routes.sign_in'


class UserSession(flask_login.UserMixin):
Expand All @@ -29,12 +27,22 @@ class RegistrationError(Exception):
Definition for errors raised by the register_user function
"""

message = None

def __init__(self, message):
self.message = message


class LoginError(Exception):
"""
Definition for errors raised by the login function
"""

message = None

def __init__(self, message):
self.message = message


@login_manager.user_loader
def user_loader(email: str):
Expand Down
Loading

0 comments on commit 0c214f5

Please sign in to comment.