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, createdByWorkspaceMember: connectedAccount.accountOwner,
})); }));
const shouldUseEmailsField = isDefined(emailsFieldMetadata);
return this.createContactService.createPeople( return this.createContactService.createPeople(
formattedContactsToCreate, formattedContactsToCreate,
shouldUseEmailsField,
workspaceId, workspaceId,
transactionManager, transactionManager,
); );

View File

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