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

Replace var with let and rename mongoose.js to ChatData.js

parent 40ea7415
Branches
No related merge requests found
......@@ -14,10 +14,10 @@ class ChatData {
}
addChat (senderId, receiverId, content) {
var participantIds = [ senderId, receiverId ]
let participantIds = [ senderId, receiverId ]
participantIds.sort()
var chat = {
let chat = {
owner_id: senderId,
content: content
}
......@@ -30,7 +30,7 @@ class ChatData {
}
if (!done) {
var chat = new this.ChatModel({
let chat = new this.ChatModel({
participant_ids: participantIds,
chats: [{
owner_id: senderId,
......@@ -44,7 +44,7 @@ class ChatData {
}
findChat (firstParticipantId, secondParticipantId) {
var participantIds = [ firstParticipantId, secondParticipantId ]
let participantIds = [ firstParticipantId, secondParticipantId ]
participantIds.sort()
this.ChatModel.findOne({ participant_ids: participantIds }, function (err, result) {
......@@ -53,7 +53,7 @@ class ChatData {
}
if (result) {
var chats = result.chats
let 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