forked from AdaGold/task-list-api
-
Notifications
You must be signed in to change notification settings - Fork 71
Rock - Nyckolle L. #52
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
NLucuab
wants to merge
28
commits into
Ada-C15:master
Choose a base branch
from
NLucuab:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
91fd8d2
completes initial setup
NLucuab a61ec77
updates task.py
NLucuab e71bdca
runs migrations
NLucuab 3f8ff6c
initializes blueprint registers it in __init__.py
NLucuab 7eadf3c
changes to routes & task class
NLucuab 8938edf
adds Procfile file for heroku deployment
NLucuab b963379
changes " to ' in __init__ file & adds comment
NLucuab ab16820
refactors GET & POST methods
NLucuab 4e07c82
adds is_complete function & improves "POST" method
NLucuab aa9d174
refactors to_json funciton & moves "GET" logic
NLucuab 14c6110
sets up route for task_id & creates "GET"
NLucuab 3e89ff4
adds DELETE logic & adds function comments
NLucuab c9cbd2f
adds PUT logic & completes Wave 1
NLucuab 32c1dbd
adds sort logic for ascending (by title)
NLucuab e07e578
adds sort logic for descending (by title)
NLucuab a1852c2
sets up "mark complete" logic for PATCH call
NLucuab 2c3c6f3
adds mark_complete endpoint logic
NLucuab bd3debe
adds "mark incomplete" logic
NLucuab a0dabbd
adds slack bot function
NLucuab 99bac13
adds column 'title' to goal and runs migrations
NLucuab 4144db2
sets up goals blueprint
NLucuab b1a06c4
adds goal routes for POST & GET calls
NLucuab e37df34
adds logic for Goal DELETE & PUT calls
NLucuab 0f42ef8
sets up one-to-many relationship btw Goal & Task
NLucuab eb303bd
POST logic for "/<goal_id>/tasks" endpoint
NLucuab bba404f
adds GET logic for one-to-many relationship
NLucuab abad9e9
adds conditional for to_json Task function
NLucuab 67bf815
fixes typo that was causing mapper error
NLucuab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn 'app:create_app()' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
from flask import current_app | ||
from sqlalchemy.orm import backref | ||
from app import db | ||
|
||
|
||
class Goal(db.Model): | ||
goal_id = db.Column(db.Integer, primary_key=True) | ||
goal_id = db.Column(db.Integer, primary_key=True, autoincrement=True) | ||
title = db.Column(db.String) | ||
tasks = db.relationship('Task', backref='goaltask', lazy=True) | ||
|
||
def goal_json(self): | ||
return { | ||
"id": self.goal_id, | ||
"title": self.title | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
from flask import current_app | ||
from app import db | ||
|
||
from sqlalchemy import DateTime | ||
from app.models.goal import Goal | ||
|
||
class Task(db.Model): | ||
task_id = db.Column(db.Integer, primary_key=True) | ||
task_id = db.Column(db.Integer, primary_key=True, autoincrement=True) | ||
title = db.Column(db.String) | ||
description = db.Column(db.String) | ||
completed_at = db.Column(db.DateTime, nullable=True) | ||
goaltask_id = db.Column(db.Integer, db.ForeignKey('goal.goal_id'), nullable=True) | ||
|
||
# creates a dictionary of key-value pairs describing the given task | ||
def to_json(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
# Wave 6: need to create a conditional for "goal_id" | ||
if self.goaltask_id == None: | ||
return { | ||
"id": self.task_id, | ||
"title": self.title, | ||
"description": self.description, | ||
"is_complete": False if self.completed_at is None else True | ||
} | ||
else: | ||
return{ | ||
"id": self.task_id, | ||
"goal_id": self.goaltask_id, | ||
"title": self.title, | ||
"description": self.description, | ||
"is_complete": False if self.completed_at is None else True | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍 love to see some helper methods!