mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
fix: new ticket trhowing error
This commit is contained in:
@@ -16,7 +16,7 @@ class Ticket extends Sequelize.Model {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.addHook("afterFind", async result => {
|
this.addHook("afterFind", async result => {
|
||||||
if (result.length > 0) {
|
if (result && result.length > 0) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
result.map(async ticket => {
|
result.map(async ticket => {
|
||||||
ticket.unreadMessages = await Message.count({
|
ticket.unreadMessages = await Message.count({
|
||||||
|
|||||||
Reference in New Issue
Block a user