-
Notifications
You must be signed in to change notification settings - Fork 146
ivy-task-list-api #133
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
base: master
Are you sure you want to change the base?
ivy-task-list-api #133
Conversation
…r function to eliminate redundancy
…le in ascending and descending order
…nd incomplete, added a function in routes which takes in both task number and complete/incomplete as variable and routes to helper functions
… need to DRY and finish up the conversion from task to goal
…ry functions to deal with new situaitons
…hon files and created a helper function for routes to validate the models to eliminate redundency in task and goal models
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.
Nice work Violet, you hit the learning goals here. I left some minor comments in the code. If you have questions let me know via Slack.
if sort_query: | ||
sort_function = getattr(sqlalchemy, sort_query) | ||
goal_list = Goal.query.order_by(sort_function(Goal.title)) | ||
else: | ||
goal_list = Goal.query.all() |
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.
clever, nice!
@goal_bp.route("random", methods=["GET"]) | ||
def get_random_goal(): |
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.
Interesting route!
@classmethod | ||
def from_dict(cls, request_body): |
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.
Great helper method
|
||
|
||
|
||
def validate_model_id(cls, id): |
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.
Nice helper function. It would be good to have another to validate required fields in the request body.
task.title = request_body["title"] | ||
task.description = request_body["description"] |
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.
No data validation here?
request_body = request.get_json() | ||
new_task = Task.from_dict(request_body) |
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.
There doesn't seem to be any validation to check to see if the request body has a title or description.
No description provided.