Remove shouldUseEmailsField (#7208)

Remove shouldUseEmailsField. This boolean was used to ensure
retro-compatibility with the old email field. It is no longer needed.
This commit is contained in:
Raphaël Bosi 2024-09-24 16:03:43 +02:00 committed by GitHub
parent 8385d3cfdf
commit 4d31995564
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 9 deletions

View File

@ -143,11 +143,8 @@ export class CreateCompanyAndContactService {
createdByWorkspaceMember: connectedAccount.accountOwner,
}));
const shouldUseEmailsField = isDefined(emailsFieldMetadata);
return this.createContactService.createPeople(
formattedContactsToCreate,
shouldUseEmailsField,
workspaceId,
transactionManager,
);

View File

@ -28,7 +28,6 @@ export class CreateContactService {
private formatContacts(
contactsToCreate: ContactToCreate[],
lastPersonPosition: number,
shouldUseEmailsField: boolean,
): DeepPartial<PersonWorkspaceEntity>[] {
return contactsToCreate.map((contact) => {
const id = v4();
@ -47,9 +46,7 @@ export class CreateContactService {
return {
id,
...(shouldUseEmailsField
? { emails: { primaryEmail: handle, additionalEmails: null } }
: { email: handle }),
emails: { primaryEmail: handle, additionalEmails: null },
name: {
firstName,
lastName,
@ -67,7 +64,6 @@ export class CreateContactService {
public async createPeople(
contactsToCreate: ContactToCreate[],
shouldUseEmailsField: boolean,
workspaceId: string,
transactionManager?: EntityManager,
): Promise<DeepPartial<PersonWorkspaceEntity>[]> {
@ -87,7 +83,6 @@ export class CreateContactService {
const formattedContacts = this.formatContacts(
contactsToCreate,
lastPersonPosition,
shouldUseEmailsField,
);
return personRepository.save(