mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 20:29:17 +00:00
feat: checking for whatsapp session Id on ticket and message creation
This commit is contained in:
@@ -39,6 +39,10 @@ class Ticket extends Sequelize.Model {
|
||||
static associate(models) {
|
||||
this.belongsTo(models.Contact, { foreignKey: "contactId", as: "contact" });
|
||||
this.belongsTo(models.User, { foreignKey: "userId", as: "user" });
|
||||
this.belongsTo(models.Whatsapp, {
|
||||
foreignKey: "whatsappId",
|
||||
as: "whatsapp",
|
||||
});
|
||||
this.hasMany(models.Message, { foreignKey: "ticketId", as: "messages" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ class Whatsapp extends Sequelize.Model {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
static associate(models) {
|
||||
this.hasMany(models.Ticket, { foreignKey: "whatsappId", as: "tickets" });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Whatsapp;
|
||||
|
||||
Reference in New Issue
Block a user