mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 19:59:20 +00:00
fix: remove ticket from all users when deleted
This commit is contained in:
@@ -27,7 +27,7 @@ const UpdateContactService = async ({
|
||||
|
||||
const contact = await Contact.findOne({
|
||||
where: { id: contactId },
|
||||
attributes: ["id", "name", "number", "email"],
|
||||
attributes: ["id", "name", "number", "email", "profilePicUrl"],
|
||||
include: ["extraInfo"]
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const CreateMessageService = async ({
|
||||
const ticket = await ShowTicketService(ticketId);
|
||||
|
||||
if (!ticket) {
|
||||
throw new AppError("No ticket found with this ID");
|
||||
throw new AppError("No ticket found with this ID", 404);
|
||||
}
|
||||
|
||||
const message: Message = await ticket.$create("message", messageData);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { where, fn, col } from "sequelize";
|
||||
import AppError from "../../errors/AppError";
|
||||
import Message from "../../models/Message";
|
||||
import Ticket from "../../models/Ticket";
|
||||
import ShowTicketService from "../TicketServices/ShowTicketService";
|
||||
@@ -24,7 +25,7 @@ const ListMessagesService = async ({
|
||||
const ticket = await ShowTicketService(ticketId);
|
||||
|
||||
if (!ticket) {
|
||||
throw new Error("No ticket found with this ID");
|
||||
throw new AppError("No ticket found with this ID", 404);
|
||||
}
|
||||
|
||||
const whereCondition = {
|
||||
|
||||
@@ -21,7 +21,7 @@ const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
||||
});
|
||||
|
||||
if (!ticket) {
|
||||
throw new AppError("No ticket found with this ID");
|
||||
throw new AppError("No ticket found with this ID", 404);
|
||||
}
|
||||
|
||||
return ticket;
|
||||
|
||||
Reference in New Issue
Block a user