Skip to content

Lions-Juila #120

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Lions-Juila #120

wants to merge 9 commits into from

Conversation

pje106
Copy link

@pje106 pje106 commented Nov 10, 2022

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Great work Julia, you hit the learning goals here. I left some minor comments in the code here. Take a look and if you have any questions please ping me in Slack.

Comment on lines +18 to +19
@classmethod
def from_dict(cls, data_dict):

Choose a reason for hiding this comment

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

Great helper method

Comment on lines +17 to +23
"description" not in response_body:
# “is_complete” not in respnse_body
return jsonify({"details": "Invalid data"}), 400
new_task = Task(
title = response_body["title"],
description = response_body["description"],)

Choose a reason for hiding this comment

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

Good validation, but you should indicate what data is invalid.

Comment on lines +32 to +40

if title_param == "asc":
tasks = Task.query.order_by(Task.title.asc())

elif title_param == "desc":
tasks = Task.query.order_by(Task.title.desc())
else:
tasks = Task.query.all()

Choose a reason for hiding this comment

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

Good use of query params.

Comment on lines +102 to +112

SLACKBOT_TOKEN = os.environ.get("SLACKBOT_TOKEN")

query_params = {
"token": SLACKBOT_TOKEN,
"channel": "task-notifications",
"text": f"Someone just completed the task {task.title}"
}

requests.post(url=PATH, data=query_params, headers={"Authorization": SLACKBOT_TOKEN})

Choose a reason for hiding this comment

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

The slack portion here should probably be in a helper function.

@@ -0,0 +1,13 @@
from flask import jsonify, abort, make_response

def get_one_obj_or_abort(cls, obj_id):

Choose a reason for hiding this comment

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

Great helper

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