You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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:
/api/tags
POST/api/tags
GET/api/tags/<int:tag_id>
PUT/api/tags/<int:tag_id>
DEL/api/tags/<int:tag_id>
GET/api/tags/<int:tag_id>/followers
PUTRoutes/functions to implement/change
Should create a TagCrud class to implement the CRUD routes with Flask-Restful
example:
Additional context
return:
The text was updated successfully, but these errors were encountered: