yusufgundogdu commited on
Commit
b7fd751
·
verified ·
1 Parent(s): 56ae1e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -0
app.py CHANGED
@@ -229,6 +229,44 @@ def get_or_create_account(platform, udid):
229
  "error": None
230
  }), 201
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  @app.route('/generate_list', methods=['GET'])
233
  def get_generate_list():
234
  return jsonify({
 
229
  "error": None
230
  }), 201
231
 
232
+
233
+ @app.route('/account/update/<id>', methods=['POST'])
234
+ def update_account(id):
235
+ # Request body'den gelen verileri al
236
+ data = request.get_json()
237
+
238
+ # ID'ye göre hesabı bul
239
+ account = next((acc for acc in fake_db["accounts"] if acc["id"] == id), None)
240
+
241
+ if not account:
242
+ return jsonify({
243
+ "success": False,
244
+ "object": None,
245
+ "error": "Account not found"
246
+ }), 404
247
+
248
+ # Sadece verilen alanları güncelle (diğerlerine dokunma)
249
+ if 'credit' in data:
250
+ account['credit'] = data['credit']
251
+ if 'level' in data:
252
+ account['level'] = data['level']
253
+
254
+ # Güncellenmiş hesabı döndür
255
+ return jsonify({
256
+ "success": True,
257
+ "object": {
258
+ "account": {
259
+ "id": account["id"],
260
+ "timestamp": account["timestamp"],
261
+ "udid": account["udid"],
262
+ "platform": account["platform"],
263
+ "credit": account["credit"],
264
+ "level": account["level"]
265
+ }
266
+ },
267
+ "error": None
268
+ })
269
+
270
  @app.route('/generate_list', methods=['GET'])
271
  def get_generate_list():
272
  return jsonify({