refactor(backend): solve copilot comments

This commit is contained in:
2025-09-24 20:10:31 +02:00
parent 3c8ad5f74f
commit f4892a69d5
12 changed files with 14 additions and 50 deletions

View File

@@ -1,2 +0,0 @@
# Konfigurace a utility

View File

@@ -1,6 +1,6 @@
import os
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
from app.core.base import Base # Import Base z nového souboru
from app.core.base import Base
DATABASE_URL = os.getenv("DATABASE_URL")
if not DATABASE_URL:
@@ -14,15 +14,11 @@ if not DATABASE_URL:
else:
raise Exception("Only MariaDB is supported. Please set the DATABASE_URL environment variable.")
# Explicitní import všech modelů, aby byly registrovány v Base.metadata
# Load all models to register them
from app.models.user import User
from app.models.transaction import Transaction
from app.models.user import User
# Pokud máš další modely, importuj je zde:
# from app.models.other_model import OtherModel
ssl_enabled = os.getenv("MARIADB_HOST", "localhost") != "localhost"
connect_args = {"ssl": {"ssl": True}} if ssl_enabled else {}

View File

@@ -32,5 +32,4 @@ def enqueue_email(to: str, subject: str, body: str) -> None:
loop.create_task(_publish_async(message))
except RuntimeError:
asyncio.run(_publish_async(message))
# ...existing code...

View File

@@ -1,2 +0,0 @@
# SQLAlchemy modely

View File

@@ -1,5 +1,5 @@
from sqlalchemy import Column, Integer, String, Float
from ..core.db import Base
from app.core.db import Base
class Transaction(Base):
__tablename__ = "transaction"

View File

@@ -1,6 +1,6 @@
from sqlalchemy import Column, String
from fastapi_users.db import SQLAlchemyBaseUserTableUUID
from ..core.base import Base # Import Base z base.py
from app.core.base import Base # Import Base z base.py
class User(SQLAlchemyBaseUserTableUUID, Base):
first_name = Column(String(length=100), nullable=True)

View File

@@ -1,2 +0,0 @@
# Pydantic schémata

View File

@@ -1,2 +0,0 @@
# Business logika

View File

@@ -11,9 +11,9 @@ from fastapi_users.authentication import (
)
from fastapi_users.db import SQLAlchemyUserDatabase
from ..models.user import User
from ..services.db import get_user_db
from ..core.queue import enqueue_email
from app.models.user import User
from app.services.db import get_user_db
from app.core.queue import enqueue_email
SECRET = os.getenv("SECRET", "CHANGE_ME_SECRET")
FRONTEND_URL = os.getenv("FRONTEND_URL", "http://localhost:5173")

View File

@@ -1,2 +0,0 @@
# Background worker