mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 11:49:19 +00:00
17 lines
380 B
TypeScript
17 lines
380 B
TypeScript
import Contact from "../../models/Contact";
|
|
import AppError from "../../errors/AppError";
|
|
|
|
const DeleteContactService = async (id: string): Promise<void> => {
|
|
const contact = await Contact.findOne({
|
|
where: { id }
|
|
});
|
|
|
|
if (!contact) {
|
|
throw new AppError("No contact found with this ID.", 404);
|
|
}
|
|
|
|
await contact.destroy();
|
|
};
|
|
|
|
export default DeleteContactService;
|