This commit is contained in:
@@ -6,11 +6,11 @@ from sqlalchemy.orm import sessionmaker
|
||||
from dibbler.conf import config
|
||||
|
||||
if (url := config.get("database", "url")) is not None:
|
||||
database_url = url
|
||||
database_url = url
|
||||
|
||||
elif (url_file := config.get("database", "url_file")) is not None:
|
||||
with Path(url_file).open() as file:
|
||||
database_url = file.read().strip()
|
||||
with Path(url_file).open() as file:
|
||||
database_url = file.read().strip()
|
||||
|
||||
engine = create_engine(database_url)
|
||||
Session = sessionmaker(bind=engine)
|
||||
|
||||
@@ -5,6 +5,7 @@ from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from dibbler.models import Base
|
||||
|
||||
|
||||
class ProductCache(Base):
|
||||
product_id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from dibbler.models import Base
|
||||
|
||||
|
||||
# More like user balance cash money flow, amirite?
|
||||
class UserBalanceCache(Base):
|
||||
user_id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
|
||||
@@ -6,6 +6,7 @@ from dibbler.queries.current_penalty import current_penalty
|
||||
# TODO: this type of transaction should be password protected.
|
||||
# the password can be set as a string literal in the config file.
|
||||
|
||||
|
||||
def adjust_penalty(
|
||||
sql_session: Session,
|
||||
user_id: int,
|
||||
|
||||
Reference in New Issue
Block a user