mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
Merge pull request #407 from ricardoapaes/hotfix/error-on-send-message
🐛 Fixing error when sending messages
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { getIO } from "../../libs/socket";
|
import { getIO } from "../../libs/socket";
|
||||||
import Message from "../../models/Message";
|
import Message from "../../models/Message";
|
||||||
import Ticket from "../../models/Ticket";
|
import Ticket from "../../models/Ticket";
|
||||||
|
import Whatsapp from "../../models/Whatsapp";
|
||||||
|
|
||||||
interface MessageData {
|
interface MessageData {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -27,7 +28,14 @@ const CreateMessageService = async ({
|
|||||||
{
|
{
|
||||||
model: Ticket,
|
model: Ticket,
|
||||||
as: "ticket",
|
as: "ticket",
|
||||||
include: ["contact", "queue"]
|
include: [
|
||||||
|
"contact", "queue",
|
||||||
|
{
|
||||||
|
model: Whatsapp,
|
||||||
|
as: "whatsapp",
|
||||||
|
attributes: ["name"]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
model: Message,
|
model: Message,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import AppError from "../../errors/AppError";
|
|||||||
import Contact from "../../models/Contact";
|
import Contact from "../../models/Contact";
|
||||||
import User from "../../models/User";
|
import User from "../../models/User";
|
||||||
import Queue from "../../models/Queue";
|
import Queue from "../../models/Queue";
|
||||||
|
import Whatsapp from "../../models/Whatsapp";
|
||||||
|
|
||||||
const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
||||||
const ticket = await Ticket.findByPk(id, {
|
const ticket = await Ticket.findByPk(id, {
|
||||||
@@ -22,6 +23,11 @@ const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
|||||||
model: Queue,
|
model: Queue,
|
||||||
as: "queue",
|
as: "queue",
|
||||||
attributes: ["id", "name", "color"]
|
attributes: ["id", "name", "color"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
model: Whatsapp,
|
||||||
|
as: "whatsapp",
|
||||||
|
attributes: ["name"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ const useStyles = makeStyles(theme => ({
|
|||||||
|
|
||||||
userTag: {
|
userTag: {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
marginRight: 5,
|
marginRight: 35,
|
||||||
right: 5,
|
right: 10,
|
||||||
bottom: 5,
|
bottom: 9,
|
||||||
background:"#2576D2",
|
background:"#2576D2",
|
||||||
color: "#ffffff",
|
color: "#ffffff",
|
||||||
border:"1px solid #CCC",
|
border:"1px solid #CCC",
|
||||||
@@ -112,7 +112,7 @@ const useStyles = makeStyles(theme => ({
|
|||||||
paddingLeft: 5,
|
paddingLeft: 5,
|
||||||
paddingRight: 5,
|
paddingRight: 5,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
fontSize: "1em"
|
fontSize: "0.9em"
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ const TicketListItem = ({ ticket }) => {
|
|||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{ticket.whatsappId && (
|
{ticket?.whatsapp && (
|
||||||
<div className={classes.userTag} title={i18n.t("ticketsList.connectionTitle")}>{ticket.whatsapp.name}</div>
|
<div className={classes.userTag} title={i18n.t("ticketsList.connectionTitle")}>{ticket.whatsapp.name}</div>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user