mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-23 07:29:39 +01:00
refactor(backend): solve copilot comments
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
# Konfigurace a utility
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
|
||||
@@ -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...
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# SQLAlchemy modely
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Pydantic schémata
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Business logika
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Background worker
|
||||
|
||||
Reference in New Issue
Block a user