mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-21 05:09:18 +00:00
18 lines
412 B
TypeScript
18 lines
412 B
TypeScript
import Contact from "../../models/Contact";
|
|
import AppError from "../../errors/AppError";
|
|
|
|
const ShowContactService = async (id: string): Promise<Contact> => {
|
|
const user = await Contact.findOne({
|
|
where: { id },
|
|
attributes: ["id", "name", "number", "email"]
|
|
});
|
|
|
|
if (!user) {
|
|
throw new AppError("No contact found with this ID.", 404);
|
|
}
|
|
|
|
return user;
|
|
};
|
|
|
|
export default ShowContactService;
|