From b01aa92f96b2f7d9c5d60e2850eee4b54cad5dee Mon Sep 17 00:00:00 2001 From: Clayton Wilson Date: Fri, 1 Nov 2019 15:39:08 -0400 Subject: [PATCH] Add post id --- functions/handlers/post.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/handlers/post.js b/functions/handlers/post.js index 2be5bda..a57cfe1 100644 --- a/functions/handlers/post.js +++ b/functions/handlers/post.js @@ -17,6 +17,7 @@ exports.putPost = (req, res) => { admin.firestore().collection('posts').add(newPost) .then((doc) => { + doc.update({postId: doc.id}) const resPost = newPost; resPost.postId = doc.id; return res.status(200).json(resPost); @@ -67,4 +68,4 @@ exports.getallPosts = (req, res) => { exports.getFilteredPosts = (req, res) => { admin.firestore().collection('posts').where('userHandle', '==', 'new user').where('microBlogTopics', '==') -}; \ No newline at end of file +};