Skip to content

add POST and GET views to connect with neo4j :)#5

Open
Twomac wants to merge 4 commits intoeons44:masterfrom
Twomac:master
Open

add POST and GET views to connect with neo4j :)#5
Twomac wants to merge 4 commits intoeons44:masterfrom
Twomac:master

Conversation

@Twomac
Copy link
Copy Markdown

@Twomac Twomac commented Oct 27, 2020

No description provided.

Copy link
Copy Markdown
Collaborator

@adamjenkins1 adamjenkins1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on making your first pull request! After addressing the comments, it would be great if you could use type hints so that the code is a little easier to read and add django unit tests to make sure that the views you've added behave how we expect.

Comment thread Neo4j Tutorials.txt Outdated
Comment thread mr_project/mr_app/__init__.py Outdated
Comment thread mr_project/mr_app/__init__.py Outdated
Comment thread mr_project/mr_app/views.py Outdated
Comment thread mr_project/mr_app/views.py Outdated
Comment thread mr_project/mr_app/views.py
Comment thread mr_project/mr_app/views.py Outdated
Comment thread mr_project/mr_project/settings.py Outdated
Comment thread neo4j install and config instruction.md Outdated
Comment thread requirements.txt
Copy link
Copy Markdown
Collaborator

@adamjenkins1 adamjenkins1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. Once you add unit tests and create the Neo4jDriverHelper singleton, we'll be ready to merge these changes.

Comment on lines +52 to +69
#FUNCTIONS THAT ACTUALLY CONNECT WITH THE DATABASE TO PERFORM TRANSACTIONS
def spawn_emotion_node(driver_arg, emotion):
with driver_arg.session() as session:
emotion_label = session.write_transaction(create_node_transaction, 'Emotion', 'name', emotion)
print(emotion_label)


def spawn_user_node(driver_arg, username):
with driver_arg.session() as session:
user_name = session.write_transaction(create_node_transaction, 'User', 'name', username)
print(user_name)


def register_emotion(driver_arg, username, emotion):
epoch_timestamp = time()
with driver_arg.session() as session:
seconds = session.write_transaction(create_epoch_relationship_between_user_and_emotion, emotion, username, epoch_timestamp)
print(seconds)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these print statements?

Comment on lines +92 to +102


@csrf_exempt
def index(request, user_id, emotion):
if request.method == 'POST':
return HttpResponse('From the heavens above to the Earth below, I alone will become the honored one.')

if request.method == 'GET':
return HttpResponse('From the heavens above to the Earth below, I alone will become the honored one.')

return HttpResponseNotFound()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we've decided to transition this to just a REST API, we can remove this view

@adamjenkins1 adamjenkins1 self-requested a review November 9, 2020 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants