mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +00:00
Corrigido erro CONTACT_NOT_FIND ao renderizar um VCard que já existia antes da atualização nova dos VCards
Agora caso encontre um VCard de um contato que não exista ele já faz a inclusão deste contato e o renderiza corretamente
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import AppError from "../../errors/AppError";
|
||||
import Contact from "../../models/Contact";
|
||||
import CreateContactService from "./CreateContactService";
|
||||
|
||||
interface ExtraInfo {
|
||||
name: string;
|
||||
@@ -20,10 +21,18 @@ const GetContactService = async ({ name, number }: Request): Promise<Contact> =>
|
||||
});
|
||||
|
||||
if (!numberExists) {
|
||||
throw new AppError("CONTACT_NOT_FIND");
|
||||
const contact = await CreateContactService({
|
||||
name,
|
||||
number,
|
||||
})
|
||||
|
||||
if (contact == null)
|
||||
throw new AppError("CONTACT_NOT_FIND")
|
||||
else
|
||||
return contact
|
||||
}
|
||||
|
||||
return numberExists;
|
||||
return numberExists
|
||||
};
|
||||
|
||||
export default GetContactService;
|
||||
Reference in New Issue
Block a user