mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 18:28:47 +00:00
Can filter posts via hardcoded topics
This commit is contained in:
parent
1a2f269466
commit
4d4b085a2b
@ -81,21 +81,21 @@ exports.getFollowedPosts = (req, res) => {
|
|||||||
let posts = [];
|
let posts = [];
|
||||||
allPosts.forEach(function(doc) {
|
allPosts.forEach(function(doc) {
|
||||||
if(followers_str.includes(doc.data().userHandle)) {
|
if(followers_str.includes(doc.data().userHandle)) {
|
||||||
|
if(doc.data().microBlogTopics.includes("purdue") || doc.data().microBlogTopics.includes("2077")) {
|
||||||
posts.push(doc.data());
|
posts.push(doc.data());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
/*posts.sort(function(a, b) {
|
||||||
|
return b.createdAt - a.createdAt;
|
||||||
|
});*/
|
||||||
return res.status(200).json(posts);
|
return res.status(200).json(posts);
|
||||||
})
|
})
|
||||||
/*.then(function() {
|
|
||||||
res.status(200).send("Successfully retrieved all posts from followed users.");
|
|
||||||
return;
|
|
||||||
})*/
|
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
res.status(500).send("Failed to retrieve posts.", err);
|
res.status(500).send("Failed to retrieve posts.", err);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
//res.status(200).send("Successfully added all follower handles to array.");
|
|
||||||
//res.status(200).send("Successfully retrieved all posts from followed users.");
|
//res.status(200).send("Successfully retrieved all posts from followed users.");
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user