mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 19:59:20 +00:00
Finished Contact Drawer styles and func
This commit is contained in:
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user