Skip to content

Commit

Permalink
add backup snipped of dleted code
Browse files Browse the repository at this point in the history
  • Loading branch information
tommasosansone91 committed Nov 8, 2024
1 parent 80ea068 commit 7fdfcb7
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# print("create new joke")

# # call the add_joke api
# response = call_add_joke_api(content)

# # turning the response object to a dictionary
# pythonified_response = response.json()
# # status_code = response.status_code

# new_response_dict = {
# "action": "insert" ,
# "updated_joke_data": pythonified_response
# }

# if response.ok:
# # Return the JSON from the response if it is successful
# return (
# json.dumps(new_response_dict),
# response.status_code,
# {'Content-Type': 'application/json'}
# )

# else:
# # Handle the case where adding the joke failed

# error_response = {
# "success": False,
# "message": "Failed to create new joke."
# }

# return (
# json.dumps(error_response),
# response.status_code,
# {'Content-Type': 'application/json'}
# )
30 changes: 30 additions & 0 deletions dev_utils/code_backups/workaround_not_to_call_get_joke_by_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@


# http://127.0.0.1:5000/api/jokes/2

# conn = sqlite3.connect(sqlite_db_path)
# curs = conn.cursor()

# # print(joke_id)
# # print(content)

# curs.execute(GET_JOKE_BY_JOKE_ID, (joke_id,))
# query_results = curs.fetchall()

# conn.close()

# listofdicts_query_results = [
# {
# "id": item[0],
# "is_active": item[1],
# "joke_version_id": item[2],
# "creation_timestamp":
# datetime.
# fromtimestamp(item[3]).
# strftime('%Y-%m-%d %H:%M:%S'),
# "content": item[4],
# }
# for item in query_results
# ]

# caller_app_jokes = listofdicts_query_results

0 comments on commit 7fdfcb7

Please sign in to comment.