Skip to content

Commit

Permalink
feat: Added user populate field
Browse files Browse the repository at this point in the history
  • Loading branch information
hossainchisty committed Mar 10, 2024
1 parent 073f748 commit 6a81cad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/postController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ const verifyAuthorization = require("../utility/verifyAuthorization");
*/

const getPosts = asyncHandler(async (req, res) => {
const posts = await Post.find({ user: req.user.id }).sort({ createdAt: -1 });
const posts = await Post.find({ user: req.user.id }).sort({ createdAt: -1 }).populate('user');

res.status(200).json({
status: 200,
success: true,
data: {
posts,
},
Expand Down

0 comments on commit 6a81cad

Please sign in to comment.