diff --git a/controllers/conversation.js b/controllers/conversation.js index 9f25ecb..11386c4 100644 --- a/controllers/conversation.js +++ b/controllers/conversation.js @@ -2,8 +2,8 @@ let Type = require('../lib/validation/type'); let validationError = require('../lib/errors/validationError'); let { User, - Conversation, - Message, + Conversation, + Message, UserConversation, Sequelize } = require('../models'); @@ -18,7 +18,7 @@ exports.create = async function (userIds, name) { let users; userIdsSet.forEach(id => { - userPromises.push(User.findById(id)); + userPromises.push(User.findByPk(id)); }); users = (await Promise.all(userPromises)).filter(user => user !== null); @@ -156,7 +156,7 @@ exports.get = async function (userId, conversationId, page) { offset = 0; } - let conversation = await Conversation.findById(conversationId, { + let conversation = await Conversation.findByPk(conversationId, { include: [ { model: User, @@ -191,7 +191,7 @@ exports.get = async function (userId, conversationId, page) { }; exports.getUserIds = async function (conversationId) { - let conversation = await Conversation.findById(conversationId, { + let conversation = await Conversation.findByPk(conversationId, { include: [{ model: User }] }); @@ -222,10 +222,10 @@ exports.updateLastRead = async function (conversationId, userId) { }; exports.updateName = async function (conversationId, userId, name) { - let conversation = await Conversation.findById(conversationId, { + let conversation = await Conversation.findByPk(conversationId, { include: [{ model: User }] }); - + if( !conversation || conversation.Users.find(u => u.id === userId) === undefined @@ -240,4 +240,4 @@ exports.updateName = async function (conversationId, userId, name) { }); return true; -}; \ No newline at end of file +}; diff --git a/controllers/message.js b/controllers/message.js index 75bdb2d..02793a6 100644 --- a/controllers/message.js +++ b/controllers/message.js @@ -10,7 +10,7 @@ let { Message, User, Conversation, Sequelize } = require('../models'); exports.create = async function (params) { let { content, userId, conversationId } = params; - let user = await User.findById(userId); + let user = await User.findByPk(userId); if(!user) { throw validationError({ message: 'User does not exist', @@ -18,7 +18,7 @@ exports.create = async function (params) { }); } - let conversation = await Conversation.findById(conversationId, { + let conversation = await Conversation.findByPk(conversationId, { include: [{ model: User, where: { id: userId } @@ -37,4 +37,4 @@ exports.create = async function (params) { await Conversation.update({ updatedAt: new Date() }, { where: { id: conversationId } }); return message; -} \ No newline at end of file +} diff --git a/controllers/user.js b/controllers/user.js index 42829a1..a52215b 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -11,7 +11,7 @@ exports.create = async function (username , password) { }; exports.get = async function (userId) { - let user = await User.findById(userId, { + let user = await User.findByPk(userId, { attributes: { exclude: ['hash'] } }); @@ -48,7 +48,7 @@ exports.getAllBeginningWith = async function (username) { } exports.login = async function (username, password) { - let user = await User.findById({ + let user = await User.findByPk({ where: { username } }); @@ -73,4 +73,4 @@ exports.login = async function (username, password) { }); } } -}; \ No newline at end of file +}; diff --git a/frontend/src/components/EmojiSelector.vue b/frontend/src/components/EmojiSelector.vue index 84248aa..2bb9549 100644 --- a/frontend/src/components/EmojiSelector.vue +++ b/frontend/src/components/EmojiSelector.vue @@ -47,7 +47,7 @@ '👶' , '👦' , '👧' , '👨' , '👩' , '👱‍♀️' , '👱' , '👴' , '👵' , '👲' , '👳‍♀️' , '👳' , '👮‍♀️' , '👮', '💁', '💁‍♂️', '🙅', '🙅‍♂️', '🙆', '🙆‍♂️', '🙋', '🙋‍♂️', '💃', '🕺', '👯', '👯‍♂️', '🚶‍♀️', '🚶', '🏃‍♀️' ]}, { title: 'animals', emojis: [ - '🐶' , '🐱' , '🐭' , '🐹' , '🐰' , '🦊' , '🐻' , '🐼' , '🐨' , '🐯' , '🦁' , '🐮' , '🐷' , '🐽' , '🐸' , '🐵' , '🙊' , '🙉' , '🙊' , '🐒' , '🐔' , '🐧' , '🐦' , '🐤' , '🐣' , '🐥' , '🦆' , '🦅' , '🦉' , '🦇' , '🐺' , '🐗' , '🐴' , '🦄' , '🐝' , '🐛' , '🦋' , '🐌' , '🐞' , '🐜' , '🕷' , '🐢' , '🐍' + '🐶' , '🐱' , '🐭' , '🐹' , '🐰' , '🦊' , '🐻' , '🐼' , '🐨' , '🐯' , '🦁' , '🐮' , '🐷' , '🐽' , '🐸' , '🐵' , '🙊' , '🙉', '🐒' , '🐔' , '🐧' , '🐦' , '🐤' , '🐣' , '🐥' , '🦆' , '🦅' , '🦉' , '🦇' , '🐺' , '🐗' , '🐴' , '🦄' , '🐝' , '🐛' , '🦋' , '🐌' , '🐞' , '🐜' , '🕷' , '🐢' , '🐍' ]}, ] } diff --git a/frontend/src/components/WallPost.vue b/frontend/src/components/WallPost.vue index 33b250c..cf6ef59 100644 --- a/frontend/src/components/WallPost.vue +++ b/frontend/src/components/WallPost.vue @@ -15,13 +15,6 @@ :class='{"post__remove_icon--show": showSelect && !post.removed}' @click.stop='toggleSelected' /> - -
-

Copy this URL to share the post

- -
- -
@@ -70,8 +63,6 @@