From 60f0a7db9642547b7db277c717c7cd6e6ff66dd3 Mon Sep 17 00:00:00 2001 From: Devin Alvaro <devin.alvaro@gmail.com> Date: Wed, 22 Nov 2017 12:08:45 +0700 Subject: [PATCH] Replace var with let and rename mongoose.js to ChatData.js --- mongoose.js => ChatData.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename mongoose.js => ChatData.js (86%) diff --git a/mongoose.js b/ChatData.js similarity index 86% rename from mongoose.js rename to ChatData.js index 1cc5d03..0930038 100644 --- a/mongoose.js +++ b/ChatData.js @@ -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) -- GitLab