fix: Remove duplicate update_customer_plan function
This commit is contained in:
parent
a4ee014397
commit
2d3318647a
|
|
@ -497,48 +497,6 @@ def get_customer(customer_id):
|
|||
}), 500
|
||||
|
||||
|
||||
@admin_bp.route('/customers/<int:customer_id>/plan', methods=['PUT'])
|
||||
def update_customer_plan(customer_id):
|
||||
"""Müşterinin planını güncelle"""
|
||||
try:
|
||||
data = request.json
|
||||
customer = Customer.query.get(customer_id)
|
||||
|
||||
if not customer:
|
||||
return jsonify({
|
||||
"status": "error",
|
||||
"message": "Müşteri bulunamadı"
|
||||
}), 404
|
||||
|
||||
# Update plan
|
||||
if 'subscription_plan' in data:
|
||||
customer.subscription_plan = data['subscription_plan']
|
||||
|
||||
if 'max_domains' in data:
|
||||
customer.max_domains = data['max_domains']
|
||||
|
||||
if 'max_containers' in data:
|
||||
customer.max_containers = data['max_containers']
|
||||
|
||||
if 'subscription_status' in data:
|
||||
customer.subscription_status = data['subscription_status']
|
||||
|
||||
db.session.commit()
|
||||
|
||||
return jsonify({
|
||||
"status": "success",
|
||||
"message": "Plan başarıyla güncellendi",
|
||||
"customer": customer.to_dict()
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
db.session.rollback()
|
||||
return jsonify({
|
||||
"status": "error",
|
||||
"message": f"Plan güncellenirken hata: {str(e)}"
|
||||
}), 500
|
||||
|
||||
|
||||
@admin_bp.route('/customers/<int:customer_id>', methods=['PUT'])
|
||||
def update_customer(customer_id):
|
||||
"""Müşteri bilgilerini güncelle"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue