Updated specific locations to be searchable, take a look at Las Vegas as an example.

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
How to test this block of code with POSTMAN?
Post Body

I am currently working on a delete function on the backend so that only authorized users can delete their reviews if they want to. I am currently trying to test it through POSTMAN but I am getting the error "Argument passed in must be a single String of 12 bytes or a string of 24 hex characters".

Currently, my POSTMAN is set up where the user is already logged in and I used their auth token and set it as the authorization header for the delete function

router.delete("/delete/:reviewId", requireAuth, async (req, res, next) => {
  const { user } = req
  const { reviewId } = req.params
  const review = await Review.findById(reviewId)
  console.log(reviewId)
  console.log(review)
  if (!review) {
    return response.status(422).json({ error: "Cannot find review" })
  }
  console.log(review.author._id.toString(), typeof review.author._id.toString())
  console.log(user.id, typeof user.id)
  if (review.author._id.toString() === user.id) {
    console.log("if is working")
    try {
      const removedReview = await review.remove()
      console.log("deleted review")
      const userUpdate = await User.updateOne(
        { _id: user.id },
        { $pull: { reviews: reviewId } }
      )
      res.json(removedReview)
    } catch (err) {
      next(err)
    }
  }
})

POSTMAN Setup Image

Author
Account Strength
100%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
8,957
Link Karma
550
Comment Karma
8,011
Profile updated: 4 days ago
Posts updated: 1 day ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago