sui
Browse files- backend/app.py +6 -6
- backend/celery_tasks/content_tasks.py +3 -3
backend/app.py
CHANGED
|
@@ -93,11 +93,11 @@ def create_app():
|
|
| 93 |
app.executor = ThreadPoolExecutor(max_workers=4)
|
| 94 |
|
| 95 |
# Register blueprints
|
| 96 |
-
from api.auth import auth_bp
|
| 97 |
-
from api.sources import sources_bp
|
| 98 |
-
from api.accounts import accounts_bp
|
| 99 |
-
from api.posts import posts_bp
|
| 100 |
-
from api.schedules import schedules_bp
|
| 101 |
|
| 102 |
app.register_blueprint(auth_bp, url_prefix='/api/auth')
|
| 103 |
app.register_blueprint(sources_bp, url_prefix='/api/sources')
|
|
@@ -115,7 +115,7 @@ def create_app():
|
|
| 115 |
def api_health_check():
|
| 116 |
"""Enhanced health check that includes database connection."""
|
| 117 |
try:
|
| 118 |
-
from utils.database import check_database_connection
|
| 119 |
db_connected = check_database_connection(app.supabase)
|
| 120 |
return {
|
| 121 |
'status': 'healthy' if db_connected else 'degraded',
|
|
|
|
| 93 |
app.executor = ThreadPoolExecutor(max_workers=4)
|
| 94 |
|
| 95 |
# Register blueprints
|
| 96 |
+
from backend.api.auth import auth_bp
|
| 97 |
+
from backend.api.sources import sources_bp
|
| 98 |
+
from backend.api.accounts import accounts_bp
|
| 99 |
+
from backend.api.posts import posts_bp
|
| 100 |
+
from backend.api.schedules import schedules_bp
|
| 101 |
|
| 102 |
app.register_blueprint(auth_bp, url_prefix='/api/auth')
|
| 103 |
app.register_blueprint(sources_bp, url_prefix='/api/sources')
|
|
|
|
| 115 |
def api_health_check():
|
| 116 |
"""Enhanced health check that includes database connection."""
|
| 117 |
try:
|
| 118 |
+
from backend.utils.database import check_database_connection
|
| 119 |
db_connected = check_database_connection(app.supabase)
|
| 120 |
return {
|
| 121 |
'status': 'healthy' if db_connected else 'degraded',
|
backend/celery_tasks/content_tasks.py
CHANGED
|
@@ -32,7 +32,7 @@ def generate_content_task(self, user_id: str, schedule_id: str, supabase_client_
|
|
| 32 |
generated_content = content_service.generate_post_content(user_id)
|
| 33 |
|
| 34 |
# Initialize Supabase client from config
|
| 35 |
-
from utils.database import init_supabase
|
| 36 |
supabase_client = init_supabase(
|
| 37 |
supabase_client_config['SUPABASE_URL'],
|
| 38 |
supabase_client_config['SUPABASE_KEY']
|
|
@@ -106,7 +106,7 @@ def publish_post_task(self, schedule_id: str, supabase_client_config: dict):
|
|
| 106 |
self.update_state(state='PROGRESS', meta={'status': 'Publishing post...'})
|
| 107 |
|
| 108 |
# Initialize Supabase client from config
|
| 109 |
-
from utils.database import init_supabase
|
| 110 |
supabase_client = init_supabase(
|
| 111 |
supabase_client_config['SUPABASE_URL'],
|
| 112 |
supabase_client_config['SUPABASE_KEY']
|
|
@@ -186,4 +186,4 @@ def publish_post_task(self, schedule_id: str, supabase_client_config: dict):
|
|
| 186 |
return {
|
| 187 |
'status': 'failure',
|
| 188 |
'message': f'Error in publishing post: {str(e)}'
|
| 189 |
-
}
|
|
|
|
| 32 |
generated_content = content_service.generate_post_content(user_id)
|
| 33 |
|
| 34 |
# Initialize Supabase client from config
|
| 35 |
+
from backend.utils.database import init_supabase
|
| 36 |
supabase_client = init_supabase(
|
| 37 |
supabase_client_config['SUPABASE_URL'],
|
| 38 |
supabase_client_config['SUPABASE_KEY']
|
|
|
|
| 106 |
self.update_state(state='PROGRESS', meta={'status': 'Publishing post...'})
|
| 107 |
|
| 108 |
# Initialize Supabase client from config
|
| 109 |
+
from backend.utils.database import init_supabase
|
| 110 |
supabase_client = init_supabase(
|
| 111 |
supabase_client_config['SUPABASE_URL'],
|
| 112 |
supabase_client_config['SUPABASE_KEY']
|
|
|
|
| 186 |
return {
|
| 187 |
'status': 'failure',
|
| 188 |
'message': f'Error in publishing post: {str(e)}'
|
| 189 |
+
}
|