Add post id

This commit is contained in:
Clayton Wilson 2019-11-01 15:39:08 -04:00 committed by GitHub
parent d6876eab0b
commit b01aa92f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ exports.putPost = (req, res) => {
admin.firestore().collection('posts').add(newPost) admin.firestore().collection('posts').add(newPost)
.then((doc) => { .then((doc) => {
doc.update({postId: doc.id})
const resPost = newPost; const resPost = newPost;
resPost.postId = doc.id; resPost.postId = doc.id;
return res.status(200).json(resPost); return res.status(200).json(resPost);