fixed errant method name refactor, added docstrings

This commit is contained in:
Lucas Jensen
2024-05-02 18:57:17 -07:00
parent f953ae3dfe
commit bd95dc2c22
7 changed files with 25 additions and 8 deletions

View File

@@ -1,10 +1,17 @@
from typing import Callable
from icecream import ic
from app.db.conn import connect_db
class BaseQueries:
from icecream import ic
"""
Base class for all query classes.
This class provides a connection to the database.
Should not be used directly; instead, inherit from this class and provide the table name.
"""
def __init__(self) -> None:
self.table: str = None # type: ignore
@@ -20,7 +27,7 @@ class BaseQueries:
db.close()
return data # type: ignore
async def select_one_series_by_id(self, id: int) -> dict | None:
async def select_one_by_id(self, id: int) -> dict | None:
query = f"SELECT * FROM {self.table} WHERE id = %s"
db = self.connect_db()
cursor = db.cursor(dictionary=True)