-
Notifications
You must be signed in to change notification settings - Fork 1
Update delete prefer #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
to work with database and test with postman
| return Response(json.dumps(['Question not Found']), | ||
| status=404, mimetype='application/json') | ||
| return jsonify({f'Question {questionId}': 'Has not been added yet'}), 404 | ||
| return jsonify({f'Question {questionId}': 'Has not been added yet'}), 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return message could be improved to "there are no questions or question doesn't exist" since its "if" statement is to query and check if there are any questions in the database.
| 'topic': question[1], | ||
| 'body': question[2] | ||
| } | ||
| return jsonify(temp), 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the returned json should come with the all answers provided so far for the question according to the notes in the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I implemented that in a new connection branch, about to send a PR
| request_data = request.get_json() | ||
| if (valid_question(request_data)): | ||
| print(request_data) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove print statements
|
|
||
| def valid_question(questionObject): | ||
| if 'topic' in questionObject and 'body' in questionObject: | ||
| if 'topic' in questionObject.keys() and 'body' in questionObject.keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can shift these validator functions to a different file and import them to use them in the views so that the routes.py has routes only
Hello, please review my PR.
I implemented all the feedback you gave, just left with Documenting and writing the Proper tests.
thanks.