mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 04:09:26 +00:00
Finished Contact Drawer styles and func
This commit is contained in:
@@ -18,7 +18,7 @@ class Contact extends Sequelize.Model {
|
||||
}
|
||||
|
||||
static associate(models) {
|
||||
this.hasMany(models.Ticket, { foreignKey: "contactId" });
|
||||
this.hasMany(models.Ticket, { foreignKey: "contactId", as: "contact" });
|
||||
this.hasMany(models.ContactCustomField, {
|
||||
foreignKey: "contactId",
|
||||
as: "extraInfo",
|
||||
|
||||
@@ -5,6 +5,7 @@ class Ticket extends Sequelize.Model {
|
||||
super.init(
|
||||
{
|
||||
status: { type: Sequelize.STRING, defaultValue: "pending" },
|
||||
userId: { type: Sequelize.INTEGER, defaultValue: null },
|
||||
lastMessage: { type: Sequelize.STRING },
|
||||
},
|
||||
{
|
||||
@@ -16,7 +17,7 @@ class Ticket extends Sequelize.Model {
|
||||
}
|
||||
|
||||
static associate(models) {
|
||||
this.belongsTo(models.Contact, { foreignKey: "contactId" });
|
||||
this.belongsTo(models.Contact, { foreignKey: "contactId", as: "contact" });
|
||||
this.belongsTo(models.User, { foreignKey: "userId" });
|
||||
this.hasMany(models.Message, { foreignKey: "ticketId" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user