def add_note(): response = "" try: data = request.get_json() except Exception as e: response = {"status": "data not found"} return jsonify(response) auth_token = request.headers.get('Authorization') if not auth_token or auth_token == "": response = {"status": "auth token not specified"} return jsonify(response) note_title = data.get('note_title') if not note_title: response = {"status": "note title not specified"} return jsonify(response) note_body = data.get("note_body") if not note_body: response = {"status": "note body not specified"} return jsonify(response) keywords = data.get("keywords") category = data.get("category") hasura_id = is_loggedin(auth_token) if not hasura_id: response = {"status": "User is not logged in. Please login first"} return jsonify(response) response = create_note(hasura_id, note_title, note_body, keywords, category) return jsonify(response)
def add_note(): response = "" try: data = request.get_json() except Exception as e: response = {"status": "data not found"} return jsonify(response) auth_token = request.headers.get('X-Hasura-Session-Id') if not auth_token or auth_token == "": response = {"status": "auth token not specified"} return jsonify(response) hasura_id = is_loggedin(auth_token) if not hasura_id: response = {"status": "User is not logged in. Please login first"} return jsonify(response) search_data = data.get("search") if not search_data: response = {"status": "Search data is not specified"} return jsonify(response) fields = data.get("fields") if not fields: fields = ['note_title', 'note_body', 'keywords', 'category'] response = search_notes(hasura_id, search_data, fields) return jsonify(response)
def add_note(): response = "" try: data = request.get_json() except Exception as e: response = {"status": "data not found"} return jsonify(response) auth_token = request.headers.get('X-Hasura-Session-Id') if not auth_token or auth_token == "": response = {"status": "auth token not specified"} return jsonify(response) hasura_id = is_loggedin(auth_token) if not hasura_id: response = {"status": "User is not logged in. Please login first"} return jsonify(response) note_id = data.get('note_id') if not note_id: response = {"status": "note id not specified"} return jsonify(response) response = delete_by_id(hasura_id, note_id) return jsonify(response)
def add_note(): response = "" auth_token = request.headers.get('Authorization') if not auth_token or auth_token == "": response = {"status": "auth token not specified"} return jsonify(response) hasura_id = is_loggedin(auth_token) if not hasura_id: response = {"status": "User is not logged in. Please login first"} return jsonify(response) response = query_all(hasura_id) return jsonify(response)