Correção da query por usuario no arquivo ShowTIcketReport.ts do backend

pull/1/head
adriano 2022-01-15 16:00:55 -03:00
parent a9d48b543d
commit 0ae0b0cf42
1 changed files with 5 additions and 10 deletions

View File

@ -8,9 +8,7 @@ import Message from "../../models/Message";
import { userInfo } from "os";
//Report by user
const ShowTicketReport = async (id: string | number): Promise<Ticket[]> => {
const ShowTicketReport = async (id: string | number): Promise<Ticket[]> => {
const ticket = await Ticket.findAll({
where: {userid: id} ,
@ -20,24 +18,21 @@ const ShowTicketReport = async (id: string | number): Promise<Ticket[]> => {
model: Message,
required:true,
separate: true,
attributes: ['body', 'read', 'mediaType', 'mediaUrl','createdAt'],
attributes: ['body', 'read', 'mediaType','fromMe', 'mediaUrl','createdAt'],
order: [
['createdAt', 'ASC']
]
},
{
model: Contact,
required:true,
model: Contact,
attributes: ['name', 'number']
},
{
model: User,
required:true,
model: User,
attributes: ['name', 'email']
},
{
model: Queue,
required:true,
model: Queue,
attributes: ['name']
},