added docstrings to event controller and moved constants
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -2,15 +2,9 @@ from asyncio import gather
|
||||
|
||||
from icecream import ic
|
||||
|
||||
from app.constants import EVENT_TABLE, SERIES_TABLE
|
||||
from app.db.base_queries import BaseQueries
|
||||
from app.models.event import (
|
||||
EVENT_TABLE,
|
||||
SERIES_TABLE,
|
||||
Event,
|
||||
EventSeries,
|
||||
NewEvent,
|
||||
NewEventSeries,
|
||||
)
|
||||
from app.models.event import Event, EventSeries, NewEvent, NewEventSeries
|
||||
|
||||
|
||||
class EventQueries(BaseQueries):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from app.constants import GROUP_TABLE
|
||||
from app.db.base_queries import BaseQueries
|
||||
from app.models.group import GROUP_TABLE
|
||||
|
||||
|
||||
class GroupQueries(BaseQueries):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from icecream import ic
|
||||
|
||||
from app.constants import MUSICIAN_TABLE
|
||||
from app.db.base_queries import BaseQueries
|
||||
from app.db.conn import connect_db
|
||||
from app.models.musician import MUSICIAN_TABLE
|
||||
|
||||
|
||||
class MusicianQueries(BaseQueries):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from app.constants import USER_TABLE
|
||||
from app.db.base_queries import BaseQueries
|
||||
from app.models.user import USER_TABLE
|
||||
|
||||
|
||||
class UserQueries(BaseQueries):
|
||||
|
||||
Reference in New Issue
Block a user