Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -222,7 +222,7 @@ def _send_system_notification(user_id, message_content, notif_type, link=None):
|
|
| 222 |
logger.error(f"Failed to send notification to {user_id} due to generic error: {e}")
|
| 223 |
return False
|
| 224 |
|
| 225 |
-
|
| 226 |
@app.route('/api/auth/signup', methods=['POST'])
|
| 227 |
def signup():
|
| 228 |
if not FIREBASE_INITIALIZED: return jsonify({'error': 'Server configuration error: Firebase not ready.'}), 503
|
|
@@ -260,7 +260,7 @@ def google_signin():
|
|
| 260 |
except auth.InvalidIdTokenError: return jsonify({'error': 'Invalid ID token from Google.'}), 401
|
| 261 |
except Exception as e: return handle_route_errors(e, uid_context=uid)
|
| 262 |
|
| 263 |
-
|
| 264 |
@app.route('/api/user/profile', methods=['GET', 'PUT'])
|
| 265 |
def user_profile():
|
| 266 |
auth_header = request.headers.get('Authorization')
|
|
@@ -285,7 +285,7 @@ def user_profile():
|
|
| 285 |
return jsonify({'success': True, 'user': {'uid': uid, **updated_profile}}), 200
|
| 286 |
except Exception as e: return handle_route_errors(e, uid_context=uid)
|
| 287 |
|
| 288 |
-
|
| 289 |
@app.route('/api/user/roles/apply', methods=['POST'])
|
| 290 |
def apply_for_role():
|
| 291 |
auth_header = request.headers.get('Authorization')
|
|
@@ -320,7 +320,7 @@ def apply_for_role():
|
|
| 320 |
return jsonify({'success': True, 'message': f'Application for {role_applied_for} submitted.', 'application_id': application_id}), 201
|
| 321 |
except Exception as e: return handle_route_errors(e, uid_context=uid)
|
| 322 |
|
| 323 |
-
|
| 324 |
@app.route('/api/admin/dashboard-stats', methods=['GET'])
|
| 325 |
def admin_dashboard_stats():
|
| 326 |
auth_header = request.headers.get('Authorization')
|
|
|
|
| 222 |
logger.error(f"Failed to send notification to {user_id} due to generic error: {e}")
|
| 223 |
return False
|
| 224 |
|
| 225 |
+
#--- Authentication Endpoints ---
|
| 226 |
@app.route('/api/auth/signup', methods=['POST'])
|
| 227 |
def signup():
|
| 228 |
if not FIREBASE_INITIALIZED: return jsonify({'error': 'Server configuration error: Firebase not ready.'}), 503
|
|
|
|
| 260 |
except auth.InvalidIdTokenError: return jsonify({'error': 'Invalid ID token from Google.'}), 401
|
| 261 |
except Exception as e: return handle_route_errors(e, uid_context=uid)
|
| 262 |
|
| 263 |
+
#--- User Profile Endpoint ---
|
| 264 |
@app.route('/api/user/profile', methods=['GET', 'PUT'])
|
| 265 |
def user_profile():
|
| 266 |
auth_header = request.headers.get('Authorization')
|
|
|
|
| 285 |
return jsonify({'success': True, 'user': {'uid': uid, **updated_profile}}), 200
|
| 286 |
except Exception as e: return handle_route_errors(e, uid_context=uid)
|
| 287 |
|
| 288 |
+
#--- Role Management Endpoints ---
|
| 289 |
@app.route('/api/user/roles/apply', methods=['POST'])
|
| 290 |
def apply_for_role():
|
| 291 |
auth_header = request.headers.get('Authorization')
|
|
|
|
| 320 |
return jsonify({'success': True, 'message': f'Application for {role_applied_for} submitted.', 'application_id': application_id}), 201
|
| 321 |
except Exception as e: return handle_route_errors(e, uid_context=uid)
|
| 322 |
|
| 323 |
+
#--- Admin Endpoints ---
|
| 324 |
@app.route('/api/admin/dashboard-stats', methods=['GET'])
|
| 325 |
def admin_dashboard_stats():
|
| 326 |
auth_header = request.headers.get('Authorization')
|