getReportedPosts = async (req, res) => {
  try {
    const communityName = req.params.name;
    const community = await Community.findOne({
      name: communityName,
    })
      .select("_id")
      .lean();

    const communityId = community._id;
    if (!community) {
      return res.status(404).json({
        message: "Community not found",
      });
    }

    const reportedPosts = await Report.find({ community: communityId })
      .populate({
        path: "post",
        model: "Post",
        select: ["_id", "body", "fileUrl", "createdAt", "user"],
        populate: {
          path: "user",
          model: "User",
          select: ["name", "avatar"],
        },
      })
      .populate({
        path: "reportedBy",
        model: "User",
        select: ["name", "avatar"],
      })
      .sort({ reportDate: -1 })
      .lean();

    if (!reportedPosts) {
      return res.status(404).json({
        message: "Reported post not found",
      });
    }
    reportedPosts.forEach((post) => {
      post.reportDate = dayjs(post.reportDate).fromNow();
    });

    return res.status(200).json({
      reportedPosts,
    });
  } catch (error) {
    res.status(500).json({
      message: "An error occurred while retrieving the reported posts",
    });
  }
}
Retrieves the reported posts for a given community,
including the post information and the user who reported it.

@route GET /communities/:name/reported-posts

@param {Object} req.params.name - The name of the community to retrieve the reported posts for.