Team-uMigrate / umigrate

Source code for the uMigrate project
13 stars 2 forks source link

API: Create contacted/confirmed users endpoints for ads, listings, and roommate posts #471

Open deandrebaker opened 3 years ago

deandrebaker commented 3 years ago

We need each of the following endpoints for ads, listings, and roommate posts:

  1. An endpoint for viewing the list of contacted users (people who have reached out to the owner of the product in an ad, listing, or roommate post)
  2. An endpoint for viewing the list of confirmed users (people who have bought the product in an ad, listing, or roommate post)
  3. An endpoint for adding the current user to the list of contacted users
  4. An endpoint for adding the current user to the list of confirmed users
  5. An endpoint for viewing the list of items that you are a contacted user for
  6. An endpoint for viewing the list of items that you are a confirmed user for

The logic for endpoints 3 - 6 has already been abstracted into the AbstractAddRemoveUser API view. You can follow what's being done in the LikedEvents API view in the events/api_views.py. image

The logic for endpoints 1 - 2 is very similar to the AbstractLikedUsers API view. The AbstractLikedUsers API view currently uses the 'liked_users' attribute on a database object . image We can make the AbstractLikedUsers API view more generic by allowing a sub-class of the AbstractLikedUsers to specify which attribute on the database object to get. We already do something similar in the AbstractAddRemoveUser image