Conversation
| @@ -1 +1,64 @@ | |||
| from flask import Blueprint No newline at end of file | |||
| from flask import Blueprint, abort, make_response, request, Response | |||
| @@ -0,0 +1,66 @@ | |||
| from flask import abort, make_response, Response, request | |||
There was a problem hiding this comment.
Remove unused imports
| from flask import abort, make_response, Response, request | |
| from flask import abort, make_response, request |
| @@ -1 +1,68 @@ | |||
| from flask import Blueprint No newline at end of file | |||
| from flask import Blueprint, abort, make_response, request, Response | |||
There was a problem hiding this comment.
abort, make_response are imported but not accessed so they should be removed
| from flask import Blueprint, abort, make_response, request, Response | |
| from flask import Blueprint, request, Response |
| class Goal(db.Model): | ||
| id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) | ||
| title: Mapped[str] | ||
| tasks: Mapped[list["Task"]] = relationship(back_populates="goal") |
| new_goal = cls(title = goal_data["title"]) | ||
| return new_goal |
There was a problem hiding this comment.
You could directly return the object since you create the variable new_goal and then immediately return it without accessing it.
| new_goal = cls(title = goal_data["title"]) | |
| return new_goal | |
| return cls(title = goal_data["title"]) |
| return new_model.to_dict(), 201 | ||
|
|
||
| def generate_slack_notification(model_attribute): | ||
| path = "https://slack.com/api/chat.postMessage" |
There was a problem hiding this comment.
constant variables should be named with all caps
| path = "https://slack.com/api/chat.postMessage" | |
| PATH = "https://slack.com/api/chat.postMessage" |
| json = { | ||
| "channel": "task-notifications", |
There was a problem hiding this comment.
The channel name appears here as a magic string should be avoided by using a constant variable instead.
| json = { | |
| "channel": "task-notifications", | |
| CHANNEL_NAME = "task-notifications" | |
| json = { | |
| "channel": CHANNEL_NAME, |
| "text": f"Someone just completed the task {model_attribute}" | ||
| } | ||
|
|
||
| slack_response = requests.post(path, headers=headers, json=json) No newline at end of file |
There was a problem hiding this comment.
You create the variable slack_response bud don't return it from the funciton.
Do you need this value and mean to return it or do we not need to return anything at all?
| slack_response = requests.post(path, headers=headers, json=json) | |
| requests.post(path, headers=headers, json=json) |
| from .routes.task_routes import bp as task_bp | ||
| from .routes.goal_routes import bp as goal_bp | ||
| from .db import db, migrate | ||
| from .models import task, goal |
There was a problem hiding this comment.
Your assertions for the tests in wave 1 look good to me 👍
No description provided.