added docstrings to event controller and moved constants

This commit is contained in:
Lucas Jensen
2024-05-02 18:30:45 -07:00
parent 9b1dfc3767
commit f953ae3dfe
16 changed files with 100 additions and 42 deletions

View File

@@ -9,6 +9,12 @@ class DBException(Exception):
def connect_db() -> mysql.connector.MySQLConnection:
"""
Connects to the MySQL database using credentials from the .env file.
Returns a MySQLConnection object which can be used by the database query layer.
Credential values are validated and an exception is raised if any are missing.
"""
load_dotenv()
host = os.getenv("DB_HOST")
user = os.getenv("DB_USER")