feat: Add new field to Tickets table to differentiate campaign tickets
parent
bfae2956a5
commit
c9750222c0
|
@ -264,7 +264,8 @@ export const remoteTicketCreation = async (
|
|||
whatsappId,
|
||||
0,
|
||||
undefined,
|
||||
queueId
|
||||
queueId,
|
||||
true
|
||||
);
|
||||
botSendMessage(ticket, `${msg}`);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { QueryInterface, DataTypes } from "sequelize";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.addColumn("Tickets", "isRemote", {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: true,
|
||||
defaultValue: false
|
||||
});
|
||||
},
|
||||
|
||||
down: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.removeColumn("Tickets", "isRemote");
|
||||
}
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
import { QueryInterface } from "sequelize";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.bulkInsert(
|
||||
"Settings",
|
||||
[
|
||||
{
|
||||
key: "filterMediasByType",
|
||||
value: "disabled",
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
}
|
||||
],
|
||||
{}
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface: QueryInterface) => {
|
||||
return queryInterface.bulkDelete("Settings", {});
|
||||
}
|
||||
};
|
|
@ -43,6 +43,10 @@ class Ticket extends Model<Ticket> {
|
|||
@Column
|
||||
isGroup: boolean;
|
||||
|
||||
@Default(false)
|
||||
@Column
|
||||
isRemote: boolean;
|
||||
|
||||
@ForeignKey(() => StatusChatEnd)
|
||||
@Column
|
||||
statusChatEndId: number;
|
||||
|
|
|
@ -14,7 +14,8 @@ const FindOrCreateTicketService = async (
|
|||
whatsappId: number,
|
||||
unreadMessages: number,
|
||||
groupContact?: Contact,
|
||||
queueId?: number | string
|
||||
queueId?: number | string,
|
||||
isRemote?: boolean
|
||||
): Promise<Ticket> => {
|
||||
try {
|
||||
let ticket;
|
||||
|
@ -106,7 +107,8 @@ const FindOrCreateTicketService = async (
|
|||
queueId,
|
||||
unreadMessages,
|
||||
whatsappId,
|
||||
phoneNumberId
|
||||
phoneNumberId,
|
||||
isRemote
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ interface TicketData {
|
|||
statusChatEndId?: number;
|
||||
unreadMessages?: number;
|
||||
whatsappId?: string | number;
|
||||
isRemote?: boolean;
|
||||
}
|
||||
|
||||
interface Request {
|
||||
|
@ -48,7 +49,8 @@ const UpdateTicketService = async ({
|
|||
statusChatEnd,
|
||||
unreadMessages,
|
||||
statusChatEndId,
|
||||
whatsappId
|
||||
whatsappId,
|
||||
isRemote
|
||||
} = ticketData;
|
||||
|
||||
const ticket = await ShowTicketService(ticketId);
|
||||
|
@ -68,7 +70,7 @@ const UpdateTicketService = async ({
|
|||
if (oldStatus === "closed") {
|
||||
await CheckContactOpenTickets(ticket.contact.id, ticket.whatsappId);
|
||||
}
|
||||
|
||||
|
||||
await ticket.update({
|
||||
status,
|
||||
queueId,
|
||||
|
@ -76,7 +78,8 @@ const UpdateTicketService = async ({
|
|||
unreadMessages,
|
||||
statusChatEnd,
|
||||
statusChatEndId,
|
||||
whatsappId
|
||||
whatsappId,
|
||||
isRemote
|
||||
});
|
||||
|
||||
await ticket.reload();
|
||||
|
|
|
@ -246,7 +246,17 @@ const TicketListItem = ({ ticket }) => {
|
|||
loading={loading}
|
||||
onClick={e => handleAcepptTicket(ticket.id)}
|
||||
>
|
||||
{i18n.t("ticketsList.buttons.accept")}
|
||||
{/* {i18n.t("ticketsList.buttons.accept")} */}
|
||||
<>
|
||||
{/* {i18n.t("ticketsList.buttons.accept")}<br />CAMPANHA */}
|
||||
|
||||
{ticket?.isRemote ? (
|
||||
<>{i18n.t("ticketsList.buttons.accept")}<br />CAMPANHA</>
|
||||
) : (
|
||||
<>{i18n.t("ticketsList.buttons.accept")}</>
|
||||
)}
|
||||
|
||||
</>
|
||||
</ButtonWithSpinner>
|
||||
)}
|
||||
</ListItem>
|
||||
|
|
Loading…
Reference in New Issue