rairo commited on
Commit
66e2e93
·
verified ·
1 Parent(s): caa33dd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -39
main.py CHANGED
@@ -428,45 +428,6 @@ def update_remaining_cash(uid):
428
  except Exception as e:
429
  return jsonify({'error': str(e)}), 400
430
 
431
- @app.route('/api/admin/users/<string:uid>/cash-limit-period', methods=['PUT'])
432
- def update_cash_limit_period(uid):
433
- try:
434
- verify_admin(request.headers.get('Authorization', ''))
435
- data = request.get_json()
436
- start_date = data.get('start_date')
437
- end_date = data.get('end_date')
438
- cash_limit = data.get('cash_limit')
439
- if not (start_date and end_date and cash_limit is not None):
440
- return jsonify({'error': 'start_date, end_date, and cash_limit are required'}), 400
441
- try:
442
- datetime.strptime(start_date, '%Y-%m-%d')
443
- datetime.strptime(end_date, '%Y-%m-%d')
444
- except Exception as e:
445
- return jsonify({'error': 'Invalid date format. Use YYYY-MM-DD for start_date and end_date'}), 400
446
-
447
- user_ref = db.reference(f'users/{uid}')
448
- user_data = user_ref.get()
449
- if not user_data:
450
- return jsonify({'error': 'User not found'}), 404
451
-
452
- user_ref.update({
453
- 'cash_limit_period': {
454
- 'start_date': start_date,
455
- 'end_date': end_date,
456
- 'limit': float(cash_limit)
457
- }
458
- })
459
-
460
- return jsonify({
461
- 'success': True,
462
- 'cash_limit_period': {
463
- 'start_date': start_date,
464
- 'end_date': end_date,
465
- 'limit': float(cash_limit)
466
- }
467
- })
468
- except Exception as e:
469
- return jsonify({'error': str(e)}), 400
470
 
471
  @app.route('/api/admin/users/<string:uid>/reset-password', methods=['PUT'])
472
  def admin_reset_password(uid):
 
428
  except Exception as e:
429
  return jsonify({'error': str(e)}), 400
430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
 
432
  @app.route('/api/admin/users/<string:uid>/reset-password', methods=['PUT'])
433
  def admin_reset_password(uid):