change delete ticket route to typescript

This commit is contained in:
canove
2020-09-19 21:14:25 -03:00
parent f221fef32d
commit 2bf5caadce
6 changed files with 43 additions and 37 deletions

View File

@@ -1,4 +1,5 @@
import AppError from "../../errors/AppError";
import Contact from "../../models/Contact";
import Ticket from "../../models/Ticket";
interface TicketData {
@@ -18,7 +19,14 @@ const UpdateTicketService = async ({
const { status, userId } = ticketData;
const ticket = await Ticket.findOne({
where: { id: ticketId }
where: { id: ticketId },
include: [
{
model: Contact,
as: "contact",
attributes: ["name", "number", "profilePicUrl"]
}
]
});
if (!ticket) {