Finished Contact Drawer styles and func

This commit is contained in:
canove
2020-07-27 16:51:54 -03:00
parent 66a1dc5fd2
commit 9477e46c24
12 changed files with 212 additions and 128 deletions

View File

@@ -28,22 +28,16 @@ const verifyContact = async (msgContact, profilePicUrl) => {
};
const verifyTicket = async contact => {
let ticket = await Ticket.findOne({
const [ticket, created] = await Ticket.findOrCreate({
where: {
status: {
[Op.or]: ["open", "pending"],
},
contactId: contact.id,
},
defaults: { contactId: contact.id, status: "pending" },
});
if (!ticket) {
ticket = await Ticket.create({
contactId: contact.id,
status: "pending",
});
}
return ticket;
};
@@ -127,6 +121,7 @@ const wbotMessageListener = () => {
...ticket.dataValues,
unreadMessages: 1,
lastMessage: newMessage.body,
contact: contact,
};
io.to(ticket.id).to("notification").emit("appMessage", {