Skip to content
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

Create Tag CRUD Routes and Connection Routes #2

Open
6 tasks done
Tracked by #4
bryanwong8 opened this issue May 9, 2020 · 0 comments · Fixed by #29
Open
6 tasks done
Tracked by #4

Create Tag CRUD Routes and Connection Routes #2

bryanwong8 opened this issue May 9, 2020 · 0 comments · Fixed by #29
Assignees
Labels
backend backend feature staging This issues is in the staging branch
Milestone

Comments

@bryanwong8
Copy link
Contributor

bryanwong8 commented May 9, 2020

Is your feature request related to a problem? Please describe.
We need to implement CRUD routes for Tags to allow them to be created, updated, deleted, and searched.

Describe the solution you'd like
Routes need to be created:

  • CreateTag - /api/tags POST
  • FetchTags - /api/tags GET
  • UpdateTag - /api/tags/<int:tag_id> PUT
  • DeleteTag - /api/tags/<int:tag_id> DEL
  • FetchTag - /api/tags/<int:tag_id> GET
  • FollowTag - /api/tags/<int:tag_id>/followers PUT

Routes/functions to implement/change
Should create a TagCrud class to implement the CRUD routes with Flask-Restful

  • TagCRUD will contain: FetchTag, UpdateTag, DeleteTag
  • Tags will contain: FetchTags, CreateTag
  • TagFollowers will contain: FollowTag
    example:
class ModelCRUD(Resource):
    def get(self):
    def post(self):
    def put(self):
    def delete(self):

Additional context

  • CreateTag: When creating a Tag, validate it with the TagFormSchema. Create a function called create_tag in utils.py in the tags folder. The function should create the Tag and return it. In the route call the create_tag function, add it to the db session and commit it. If successful, return:
{
	"message": "Tag successfully created"
}, 201
  • UpdateTag: Update a Tag by first validating the form data with the TagFormData schema. Query for the Tag by the id given in the route. Create a function called update_tag in utils.py in the tags folder it should take in the Tag and form data as parameters. The function should update the Tag's parameters. If successful, return:
    return:
{
	"message": "Tag successfully updated"
}, 200
  • DeleteTag: Query for the Tag by id. Use db.session.delete() to delete the object. If successful, return:
{
	"message": "Tag successfully deleted"
}, 200
  • FecthTag: Query for the Tag by id. Return the serialization with TagSchema.
  • FetchTags: Query for a maximum of 15 Tags and serialize and return it with TagsSchema
  • FollowTag: Add the current user from the User session to the Tag's users' column
@bryanwong8 bryanwong8 added this to the Week 1 milestone May 9, 2020
@bryanwong8 bryanwong8 mentioned this issue May 9, 2020
6 tasks
@bryanwong8 bryanwong8 added the backend backend feature label May 11, 2020
@bryanwong8 bryanwong8 changed the title Create Tag CRUD Routes Create Tag CRUD Routes and Connection Routes May 11, 2020
@grchng grchng mentioned this issue May 16, 2020
@grchng grchng linked a pull request May 16, 2020 that will close this issue
@grchng grchng closed this as completed May 16, 2020
@bryanwong8 bryanwong8 reopened this May 17, 2020
@grchng grchng added the staging This issues is in the staging branch label May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend backend feature staging This issues is in the staging branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants