def get_profile(id): user = main_db('get_user', id) print("USER", user) if not user: return Response(json.dumps({'Success': 'user not found'})) dog = main_db('get_dogs', id) if 'error' in dog: return Response(json.dumps({'Error': dog['details']})), dog['error'] user['dog'] = dog return Response(json.dumps(user))
def update_request(id): params = request.get_json() print(id, params) response = main_db('update_request', id, params.get('sender_id'), params.get('response')) print(response) if response and 'error' in response: return Response(json.dumps({'Error': response['details']})), response['error'] return Response(json.dumps({"Success": "Updated Successfully"}))
def get_matches(id): id = int(id) response = main_db('find_match', id) if response and 'error' in response: return Response(json.dumps({'Error': response['details']})), response['error'] return Response(json.dumps(response))
def get_requests(id): response = main_db('get_requests', id) if response and 'error' in response: return Response(json.dumps({'Error': response['details']})), response['error'] return Response(json.dumps(response))
def update_status(id, status): print(id, status) response = main_db('change_status', id, status) if response and 'error' in response: return Response(json.dumps({'Error': response['details']})), response['error'] return Response(json.dumps({"Success": 'status updated successfully'}))