fix: Remove duplicate get_cloudflare_accounts endpoint
This commit is contained in:
parent
71d499aee1
commit
b4c659f214
|
|
@ -12,48 +12,6 @@ from datetime import datetime
|
|||
customer_bp = Blueprint('customer', __name__, url_prefix='/api/customer')
|
||||
|
||||
|
||||
@customer_bp.route('/cloudflare-accounts', methods=['GET'])
|
||||
@token_required
|
||||
def get_cloudflare_accounts(current_user):
|
||||
"""Get available Cloudflare accounts for customer"""
|
||||
try:
|
||||
customer = current_user.customer
|
||||
if not customer:
|
||||
return jsonify({'error': 'Customer profile not found'}), 404
|
||||
|
||||
# Fetch available CF accounts from Admin Panel
|
||||
admin_api = AdminAPIService()
|
||||
accounts_result = admin_api.get_available_cf_accounts()
|
||||
|
||||
if accounts_result['status'] == 'success':
|
||||
# Filter only active accounts with available capacity
|
||||
available_accounts = [
|
||||
acc for acc in accounts_result.get('accounts', [])
|
||||
if acc.get('is_active') and acc.get('available_capacity', 0) > 0
|
||||
]
|
||||
|
||||
return jsonify({
|
||||
'status': 'success',
|
||||
'accounts': available_accounts,
|
||||
'total': len(available_accounts)
|
||||
}), 200
|
||||
else:
|
||||
return jsonify({
|
||||
'status': 'error',
|
||||
'accounts': [],
|
||||
'total': 0,
|
||||
'error': accounts_result.get('error', 'Failed to fetch CF accounts')
|
||||
}), 200
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
'status': 'error',
|
||||
'accounts': [],
|
||||
'total': 0,
|
||||
'error': str(e)
|
||||
}), 500
|
||||
|
||||
|
||||
@customer_bp.route('/domains', methods=['GET'])
|
||||
@token_required
|
||||
def get_domains(current_user):
|
||||
|
|
|
|||
Loading…
Reference in New Issue