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