fixed some backend and database stuff

This commit is contained in:
Patrick_Pluto 2024-10-01 15:34:43 +02:00
parent 7c2f179c8b
commit e594ecd7c2
6 changed files with 567 additions and 525 deletions

View file

@ -97,6 +97,7 @@ class API:
@self.app.route('/interstellar_ai/db', methods=['POST'])
def db_manipulate():
sent_data = request.get_json()
print(sent_data)
action = sent_data.get('action')
if action == "create_account":
return jsonify({'status': 200, 'response': self.db.add_user(sent_data)})
@ -110,6 +111,10 @@ class API:
return jsonify({'status': 200, 'response': self.db.check_credentials(sent_data)})
elif action == "delete_account":
return jsonify({'status': 200, 'response': self.db.delete_user(sent_data)})
elif action == "get_email":
return jsonify({'status': 200, 'response': self.db.get_email(sent_data)})
elif action == "get_name":
return jsonify({'status': 200, 'response': self.db.get_name(sent_data)})
return jsonify({'status': 401, 'response': "Invalid action"})