Refactor OAuth provider linking and unlinking logic into a dedicated service; enhance error handling and logging throughout the application; improve sound management and scanning services with better file handling and unique naming; implement centralized error and logging services for consistent API responses and application-wide logging configuration.

This commit is contained in:
JSC
2025-07-05 13:07:06 +02:00
parent 41fc197f4c
commit e2fe451e5a
17 changed files with 758 additions and 352 deletions

View File

@@ -3,7 +3,6 @@
import logging
from flask import request
from flask_jwt_extended import decode_token
from flask_socketio import disconnect, emit, join_room, leave_room
from app import socketio
@@ -41,12 +40,12 @@ class SocketIOService:
try:
from flask import current_app
from flask_jwt_extended import decode_token
# Check if we have the access_token cookie
access_token = request.cookies.get("access_token_cookie")
if not access_token:
return None
# Decode the JWT token manually
with current_app.app_context():
try:
@@ -59,6 +58,7 @@ class SocketIOService:
# Query database for user data
from app.models.user import User
user = User.query.get(int(current_user_id))
if not user or not user.is_active:
return None
@@ -131,4 +131,4 @@ def handle_disconnect() -> None:
# Export the service instance
socketio_service = SocketIOService()
socketio_service = SocketIOService()