mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +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 AppError from "../../errors/AppError";
|
||||||
import Contact from "../../models/Contact";
|
import Contact from "../../models/Contact";
|
||||||
|
import CreateContactService from "./CreateContactService";
|
||||||
|
|
||||||
interface ExtraInfo {
|
interface ExtraInfo {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -20,10 +21,18 @@ const GetContactService = async ({ name, number }: Request): Promise<Contact> =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!numberExists) {
|
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;
|
export default GetContactService;
|
||||||
Reference in New Issue
Block a user