mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 11:49:19 +00:00
improvement: show username on ticket header
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const Message = require("../models/Message");
|
||||
const Contact = require("../models/Contact");
|
||||
const User = require("../models/User");
|
||||
|
||||
const Ticket = require("../models/Ticket");
|
||||
const { getIO } = require("../libs/socket");
|
||||
@@ -52,6 +53,10 @@ exports.index = async (req, res, next) => {
|
||||
include: "extraInfo",
|
||||
attributes: ["id", "name", "number", "profilePicUrl"],
|
||||
},
|
||||
{
|
||||
model: User,
|
||||
as: "user",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class Ticket extends Sequelize.Model {
|
||||
|
||||
static associate(models) {
|
||||
this.belongsTo(models.Contact, { foreignKey: "contactId", as: "contact" });
|
||||
this.belongsTo(models.User, { foreignKey: "userId" });
|
||||
this.belongsTo(models.User, { foreignKey: "userId", as: "user" });
|
||||
this.hasMany(models.Message, { foreignKey: "ticketId" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ const MessagesList = () => {
|
||||
loading ? (
|
||||
<Skeleton animation="wave" width={80} />
|
||||
) : (
|
||||
`Atribuído á ${ticket.userId}`
|
||||
ticket.user && `Atribuído à: ${ticket.user.name}`
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user