Skip to content

Possum-Esmeralda Arreguin-Martinez#21

Open
esmerarre wants to merge 17 commits intoAda-C24:mainfrom
esmerarre:main
Open

Possum-Esmeralda Arreguin-Martinez#21
esmerarre wants to merge 17 commits intoAda-C24:mainfrom
esmerarre:main

Conversation

@esmerarre
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Nice work on task-list-api!

Comment thread app/routes/task_routes.py
@@ -1 +1,64 @@
from flask import Blueprint No newline at end of file
from flask import Blueprint, abort, make_response, request, Response
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove unused imports

@@ -0,0 +1,66 @@
from flask import abort, make_response, Response, request
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove unused imports

Suggested change
from flask import abort, make_response, Response, request
from flask import abort, make_response, request

Comment thread app/routes/goal_routes.py
@@ -1 +1,68 @@
from flask import Blueprint No newline at end of file
from flask import Blueprint, abort, make_response, request, Response
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

abort, make_response are imported but not accessed so they should be removed

Suggested change
from flask import Blueprint, abort, make_response, request, Response
from flask import Blueprint, request, Response

Comment thread app/models/goal.py
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")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 A goal has many tasks

Comment thread app/models/goal.py
Comment on lines +28 to +29
new_goal = cls(title = goal_data["title"])
return new_goal
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could directly return the object since you create the variable new_goal and then immediately return it without accessing it.

Suggested change
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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

constant variables should be named with all caps

Suggested change
path = "https://slack.com/api/chat.postMessage"
PATH = "https://slack.com/api/chat.postMessage"

Comment on lines +61 to +62
json = {
"channel": "task-notifications",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The channel name appears here as a magic string should be avoided by using a constant variable instead.

Suggested change
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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?

Suggested change
slack_response = requests.post(path, headers=headers, json=json)
requests.post(path, headers=headers, json=json)

Comment thread app/__init__.py
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove unused imports

Comment thread tests/test_wave_01.py
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your assertions for the tests in wave 1 look good to me 👍

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