FIrst nonorganic posts
This commit is contained in:
@@ -20,8 +20,21 @@ DB.getDB.then((DB) => {
|
||||
const profileid = getProfileId(req);
|
||||
let posts = await DB.getFeed(profileid);
|
||||
//Add non-organic posts
|
||||
|
||||
return res.json(posts)
|
||||
const popularProfiles = await DB.getPopularProfiles(5);
|
||||
let content = "Popular users to follow:\n";
|
||||
popularProfiles.forEach((p)=>{
|
||||
content += "@p:" + p._id + "\n";
|
||||
});
|
||||
let popularProfilesPost = new Post({profileid: 1, content, nonOrganicType: "PopularUsers"});
|
||||
const popularGroups = await DB.getPopularGroups(5);
|
||||
content = "Popular users to follow:\n";
|
||||
popularGroups.forEach((p)=>{
|
||||
content += "@p:" + p._id + "\n";
|
||||
});
|
||||
let popularGroupsPost = new Post({profileid: 1, content, nonOrganicType: "PopularGroups"});
|
||||
posts.push(popularProfilesPost);
|
||||
posts.push(popularGroupsPost);
|
||||
return res.json(posts);
|
||||
});
|
||||
|
||||
router.get("/usr/:id", async (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user