Fix domain name parsing on company creation (#4297)

* add domain parsing library

* change package for psl

* trying to fix error

* fix

* update

* remove unused function
This commit is contained in:
bosiraphael
2024-03-04 17:50:41 +01:00
committed by GitHub
parent aa7fa3acfa
commit 735e75b3b1
6 changed files with 28 additions and 8 deletions

View File

@ -28,7 +28,7 @@ export class CreateCompaniesAndContactsService {
workspaceId: string,
transactionManager?: EntityManager,
) {
if (participants.length === 0) {
if (!participants || participants.length === 0) {
return;
}
@ -51,6 +51,10 @@ export class CreateCompaniesAndContactsService {
const { uniqueParticipants, uniqueHandles } =
getUniqueParticipantsAndHandles(participantsFromOtherCompanies);
if (uniqueHandles.length === 0) {
return;
}
const alreadyCreatedContacts = await this.personService.getByEmails(
uniqueHandles,
workspaceId,

View File

@ -23,6 +23,10 @@ export class CreateCompanyService {
): Promise<{
[domainName: string]: string;
}> {
if (domainNames.length === 0) {
return {};
}
const uniqueDomainNames = [...new Set(domainNames)];
const existingCompanies =