Skip to content
Snippets Groups Projects
Commit 1a51e32f authored by Devin Alvaro's avatar Devin Alvaro
Browse files

Add findChat() method to ChatData

parent 62b93a72
Branches
No related merge requests found
......@@ -41,4 +41,23 @@ class ChatData {
}
})
}
findChat (firstParticipantId, secondParticipantId) {
var participantIds = [ firstParticipantId, secondParticipantId ]
participantIds.sort()
this.ChatModel.findOne({ participant_ids: participantIds }, function (err, result) {
if (err) {
return console.error(err)
}
if (result) {
var chats = result.chats
chats.forEach(function (chat) {
console.log(chat)
})
}
})
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment