mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2026-03-10 13:15:05 +00:00
quoting mblogs userline
This commit is contained in:
@@ -32,6 +32,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.get()
|
||||||
.then(function(myPosts) {
|
.then(function(myPosts) {
|
||||||
let posts = [];
|
let posts = [];
|
||||||
@@ -92,15 +93,21 @@ exports.quoteWithPost = (req, res) => {
|
|||||||
return admin.firestore().collection('quote').add({
|
return admin.firestore().collection('quote').add({
|
||||||
postId : req.params.postId,
|
postId : req.params.postId,
|
||||||
userHandle : req.user.handle,
|
userHandle : req.user.handle,
|
||||||
quotePost : req.body.quotePost
|
body : req.body.body
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return admin.firestore().collection('posts').add({
|
return admin.firestore().collection('posts').add({
|
||||||
quoteData,
|
|
||||||
quoteUser : req.user.handle,
|
|
||||||
quotePost : req.body.quotePost,
|
|
||||||
quotedAt : new Date().toISOString()
|
|
||||||
|
|
||||||
|
userHandle : req.user.handle,
|
||||||
|
body: req.body.body,
|
||||||
|
createdAt : new Date().toISOString(),
|
||||||
|
userImage: req.body.userImage,
|
||||||
|
likeCount: 0,
|
||||||
|
commentCount: 0,
|
||||||
|
userID: req.user.uid,
|
||||||
|
microBlogTitle: quoteData.microBlogTitle,
|
||||||
|
microBlogTopics: quoteData.microBlogTopics,
|
||||||
|
postId: req.params.postId
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -139,12 +146,20 @@ exports.quoteWithoutPost = (req, res) => {
|
|||||||
return admin.firestore().collection('quote').add({
|
return admin.firestore().collection('quote').add({
|
||||||
postId : req.params.postId,
|
postId : req.params.postId,
|
||||||
userHandle : req.user.handle,
|
userHandle : req.user.handle,
|
||||||
|
body: null
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return admin.firestore().collection('posts').add({
|
return admin.firestore().collection('posts').add({
|
||||||
quoteData,
|
userHandle : req.user.handle,
|
||||||
quoteUser : req.user.handle,
|
body: null,
|
||||||
quotedAt : new Date().toISOString()
|
createdAt : new Date().toISOString(),
|
||||||
|
likeCount: 0,
|
||||||
|
commentCount: 0,
|
||||||
|
userID: req.user.uid,
|
||||||
|
userImage: req.body.userImage,
|
||||||
|
microBlogTitle: quoteData.microBlogTitle,
|
||||||
|
microBlogTopics: quoteData.microBlogTopics,
|
||||||
|
postId: req.params.postId
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user