mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 21:25:04 +00:00
Posts are now sorted by date
This commit is contained in:
@@ -30,7 +30,7 @@ exports.putPost = (req, res) => {
|
|||||||
|
|
||||||
exports.getallPostsforUser = (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.get()
|
post_query.orderBy('createdAt', 'desc').get()
|
||||||
.then(function(myPosts) {
|
.then(function(myPosts) {
|
||||||
let posts = [];
|
let posts = [];
|
||||||
myPosts.forEach(function(doc) {
|
myPosts.forEach(function(doc) {
|
||||||
@@ -49,7 +49,7 @@ exports.getallPostsforUser = (req, res) => {
|
|||||||
|
|
||||||
exports.getallPosts = (req, res) => {
|
exports.getallPosts = (req, res) => {
|
||||||
var post_query = admin.firestore().collection("posts");
|
var post_query = admin.firestore().collection("posts");
|
||||||
post_query.get()
|
post_query.orderBy('createdAt', 'desc').get()
|
||||||
.then(function(allPosts) {
|
.then(function(allPosts) {
|
||||||
let posts = [];
|
let posts = [];
|
||||||
allPosts.forEach(function(doc) {
|
allPosts.forEach(function(doc) {
|
||||||
@@ -67,7 +67,7 @@ exports.getallPosts = (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.getFilteredPosts = (req, res) => {
|
exports.getFilteredPosts = (req, res) => {
|
||||||
admin.firestore().collection('posts').where('userHandle', '==', 'new user').where('microBlogTopics', '==')
|
admin.firestore().collection('posts').where('userHandle', '==', 'new user').where('microBlogTopics', '==');
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getFollowedPosts = (req, res) => {
|
exports.getFollowedPosts = (req, res) => {
|
||||||
@@ -82,7 +82,7 @@ exports.getFollowedPosts = (req, res) => {
|
|||||||
followers_likedTopics.set(followers.data().handle, followers.data().followedTopics);
|
followers_likedTopics.set(followers.data().handle, followers.data().followedTopics);
|
||||||
});
|
});
|
||||||
|
|
||||||
post_query.get()
|
post_query.orderBy('createdAt', 'desc').get()
|
||||||
.then(function(allPosts) {
|
.then(function(allPosts) {
|
||||||
let posts = [];
|
let posts = [];
|
||||||
allPosts.forEach(function(doc) {
|
allPosts.forEach(function(doc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user