Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function handleDeletedMessage(req, res) {
- var db = firestore.firestore();
- db.collection("GroupMessages")
- .doc(req.params.groupConvoId)
- .collection("Messages")
- .doc(req.params.deletedMessageId)
- .get()
- .then(snapshot => {
- if (snapshot.exists) {
- db.collection("GroupMessages")
- .doc(req.params.groupConvoId)
- .collection("Messages")
- .orderBy("createdAt", "desc")
- .where("wasRemoved", "==", false)
- .endBefore(snapshot.data().createdAt)
- .limit(3)
- .get()
- .then(docSnapshot => {
- console.log(docSnapshot); // size here is always 0
- if (docSnapshot.size > 0) {
- res.success();
- } else {
- res.error("nothing");
- }
- }).catch(error => {
- console.log(`There was an error getting the deleted message inner: ${error}`);
- res.error("Unable to get deleted message");
- assert.ok(true);
- });
- } else {
- res.error("Unable to get deleted message snapshot");
- }
- }).catch(error => {
- console.log(`There was an error getting the deleted message: ${error}`);
- res.error("Unable to get deleted message");
- assert.ok(true);
- });
Add Comment
Please, Sign In to add comment