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