mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
Fixed a small bug in sorting userline posts
This commit is contained in:
parent
81593cee52
commit
4b440d28de
@ -29,12 +29,14 @@ exports.putPost = (req, res) => {
|
||||
};
|
||||
|
||||
exports.getallPostsforUser = (req, res) => {
|
||||
var post_query = admin.firestore().collection("posts").where("userHandle", "==", req.user.handle);
|
||||
var post_query = admin.firestore().collection("posts");//.where("userHandle", "==", req.user.handle);
|
||||
post_query.orderBy('createdAt', 'desc').get()
|
||||
.then(function(myPosts) {
|
||||
let posts = [];
|
||||
myPosts.forEach(function(doc) {
|
||||
if(doc.data().userHandle === req.user.handle) {
|
||||
posts.push(doc.data());
|
||||
}
|
||||
});
|
||||
return res.status(200).json(posts);
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user