bitprj / bit-next

Home Page:https://bit-next.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Tag feature

bryanwong8 opened this issue · comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

  • (Hackathon) Add the following fields for the Tag model in backend/conduit/tags/models.py:
    • description: text
    • slug: string(100)
    • icon: string(50)
    • modSetting: int
    • tagFollowers: relationship with UserProfile model
    • moderators: relationship with UserProfile model
  • (Hackathon) Create a schema to update a Tag.
    • The schema should include description, slug, icon, and mod setting. Follow the example on how the schemas are made in backend/conduit/articles/serializers.py and apply them to backend/conduit/tags/serializers.py
  • (Hackathon) Create the Update and Delete routes in backend/conduit/tags/views.py. You should follow a similar syntax to how the CRUD routes are made in backend/conduit/articles/views.py
  • (Hackathon) Create a follow and unfollow tag route in backend/conduit/tags/views.py. The route should add the current user to the Tag's followers list. For unfollow, remove the user from the Tag's followers list.
  • (Hackathon) Create a route that returns all of the followers and moderators for a Tag called get_members_from_tag
  • Create a route to return all of a user's tags called, profile_tags in backend/conduit/profile/views.py
  • Create a claim_tag route where an Admin (a User with the isAdmin boolean == True) adds themself to the moderatos column.
    • Should also create a route called invite_moderator to invite users as moderators for the targeted tag.
  • Add a needsReview boolean column to the Article model in backend/conduit/articles/models.py. The default should be false.
    • Modify the get_articles backend/conduit/articles/views.py to fetch only articles where needsReview is false.
  • Modify the make_article in backend/conduit/articles/views.py. If the tag's modSetting is 3, then check if the user is an admin first before posting else dont post it and remove the tag from the article. If the tags's modSetting is 2 then send the variable needsReview to true when creating the tag.
  • Add an isAdmin field to the User model in backend/conduit/users/models.py. By default this value should be false.
    • Create a decorator in backend/conduit/utils.py to check if the user is an admin. It would help to make a class function in the User model to return the isAdmin boolean.
  • Create a route in backend/conduit/articles/views.py called review_article which allows moderators to make the article public or not. If needsReview is set to true, then remove it from the moderator's list. If it is false leave it alone. Only moderators can call this route.
    • You should create a class function called review to change the variable from true to false
  • Create test functions in backend/tests/test_tags.py to test all the routes in backend/conduit/tags/views.py. Each route should be its own test function

Additional context

  • If modSetting is 1, then anyone can write an Article to the Tag without it review. If the modSetting is 2, the every Article needs to be reviewed before it is published. If modSetting is 3, then only Admins can post articles to the Tag.
  • You should create a class function to add users to the tag's moderator list

Completed