mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-04-26 01:45:04 +00:00
before npm rebuild
This commit is contained in:
@@ -79,6 +79,25 @@ exports.getFilteredPostsOnTopics = (req, res) => {
|
||||
var topics = new Set();
|
||||
topics.add(queryTopics.get().microBlogTopics)
|
||||
|
||||
var queryPosts = admin.firestore().collection('posts');
|
||||
|
||||
//console.log(topics);
|
||||
|
||||
var queryPosts = admin.firestore().collection('posts').where('microBlogTopics','==', topics);
|
||||
|
||||
console.log(queryPosts);
|
||||
|
||||
queryPosts.get()
|
||||
.then(function(Posts) {
|
||||
let posts = [];
|
||||
Posts.forEach(function(doc){
|
||||
posts.push(doc.data());
|
||||
});
|
||||
return res.status(200).json(posts);
|
||||
})
|
||||
.then(function() {
|
||||
res.status(200).send("Successfully retrieved filtered posts from database.");
|
||||
return;
|
||||
})
|
||||
.catch(function(err) {
|
||||
res.status(500).send("Failed to retrieve posts from database.", err);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user