Can filter posts via hardcoded topics

This commit is contained in:
Aaron Sun 2019-11-18 22:01:28 -05:00
parent 1a2f269466
commit 4d4b085a2b

View File

@ -81,21 +81,21 @@ exports.getFollowedPosts = (req, res) => {
let posts = [];
allPosts.forEach(function(doc) {
if(followers_str.includes(doc.data().userHandle)) {
posts.push(doc.data());
if(doc.data().microBlogTopics.includes("purdue") || doc.data().microBlogTopics.includes("2077")) {
posts.push(doc.data());
}
}
});
/*posts.sort(function(a, b) {
return b.createdAt - a.createdAt;
});*/
return res.status(200).json(posts);
})
/*.then(function() {
res.status(200).send("Successfully retrieved all posts from followed users.");
return;
})*/
.catch(function(err) {
res.status(500).send("Failed to retrieve posts.", err);
});
})
.then(function() {
//res.status(200).send("Successfully added all follower handles to array.");
//res.status(200).send("Successfully retrieved all posts from followed users.");
return;
})