Migrate domainName field from text type to links type (#6410)

Closes #5759.
This commit is contained in:
Marie
2024-07-30 11:47:37 +02:00
committed by GitHub
parent fb0fd99a38
commit 8e35edad30
44 changed files with 888 additions and 217 deletions

View File

@ -1,7 +1,7 @@
import { ReactNode } from 'react';
import { gql, InMemoryCache } from '@apollo/client'; import { gql, InMemoryCache } from '@apollo/client';
import { MockedProvider } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing';
import { act, renderHook } from '@testing-library/react'; import { act, renderHook } from '@testing-library/react';
import { ReactNode } from 'react';
import { RecoilRoot, useSetRecoilState } from 'recoil'; import { RecoilRoot, useSetRecoilState } from 'recoil';
import { useActivityTargetObjectRecords } from '@/activities/hooks/useActivityTargetObjectRecords'; import { useActivityTargetObjectRecords } from '@/activities/hooks/useActivityTargetObjectRecords';
@ -45,7 +45,11 @@ const activityNode = {
company: { company: {
id: '89bb825c-171e-4bcc-9cf7-43448d6fb280', id: '89bb825c-171e-4bcc-9cf7-43448d6fb280',
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainName: {
primaryLinkUrl: 'https://www.airbnb.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
}, },
person: null, person: null,
activityId: '89bb825c-171e-4bcc-9cf7-43448d6fb230', activityId: '89bb825c-171e-4bcc-9cf7-43448d6fb230',
@ -90,7 +94,11 @@ cache.writeFragment({
company { company {
id id
name name
domainName domainName {
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
} }
person person
activityId activityId

View File

@ -33,6 +33,7 @@ import { commandMenuCommandsState } from '../states/commandMenuCommandsState';
import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState'; import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
import { Command, CommandType } from '../types/Command'; import { Command, CommandType } from '../types/Command';
import { getCompanyDomainName } from '@/object-metadata/utils/getCompanyDomainName';
import { LightIconButton } from '@/ui/input/button/components/LightIconButton'; import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
import { CommandGroup } from './CommandGroup'; import { CommandGroup } from './CommandGroup';
import { CommandMenuItem } from './CommandMenuItem'; import { CommandMenuItem } from './CommandMenuItem';
@ -429,7 +430,7 @@ export const CommandMenu = () => {
placeholderColorSeed={company.id} placeholderColorSeed={company.id}
placeholder={company.name} placeholder={company.name}
avatarUrl={getLogoUrlFromDomainName( avatarUrl={getLogoUrlFromDomainName(
company.domainName, getCompanyDomainName(company),
)} )}
/> />
)} )}

View File

@ -5,7 +5,13 @@ export type Company = {
updatedAt?: string; updatedAt?: string;
deletedAt?: string | null; deletedAt?: string | null;
name: string; name: string;
domainName: string; domainName:
| string
| {
__typename?: 'Links';
primaryLinkUrl: string;
primaryLinkLabel: string;
};
address: string; address: string;
accountOwnerId?: string | null; accountOwnerId?: string | null;
position?: number; position?: number;

View File

@ -143,7 +143,11 @@ export const mocks = [
primaryLinkLabel primaryLinkLabel
secondaryLinks secondaryLinks
} }
domainName domainName {
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue { annualRecurringRevenue {
amountMicros amountMicros
currencyCode currencyCode
@ -273,7 +277,11 @@ export const mocks = [
primaryLinkLabel primaryLinkLabel
secondaryLinks secondaryLinks
} }
domainName domainName {
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue { annualRecurringRevenue {
amountMicros amountMicros
currencyCode currencyCode

View File

@ -1,3 +1,4 @@
import { getCompanyDomainName } from '@/object-metadata/utils/getCompanyDomainName';
import { getLogoUrlFromDomainName } from '~/utils'; import { getLogoUrlFromDomainName } from '~/utils';
import { isDefined } from '~/utils/isDefined'; import { isDefined } from '~/utils/isDefined';
@ -19,7 +20,9 @@ export const mapFavorites = (favorites: any) => {
? { ? {
id: favorite.company.id, id: favorite.company.id,
labelIdentifier: favorite.company.name, labelIdentifier: favorite.company.name,
avatarUrl: getLogoUrlFromDomainName(favorite.company.domainName), avatarUrl: getLogoUrlFromDomainName(
getCompanyDomainName(favorite.company),
),
avatarType: 'squared', avatarType: 'squared',
link: `/object/company/${favorite.company.id}`, link: `/object/company/${favorite.company.id}`,
} }

View File

@ -61,6 +61,11 @@ linkedinLink
secondaryLinks secondaryLinks
} }
domainName domainName
{
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue annualRecurringRevenue
{ {
amountMicros amountMicros
@ -95,7 +100,11 @@ idealCustomerProfile
people: true, people: true,
xLink: true, xLink: true,
linkedinLink: true, linkedinLink: true,
domainName: true, domainName: {
primaryLinkUrl: true,
primaryLinkLabel: true,
secondaryLinks: true,
},
annualRecurringRevenue: true, annualRecurringRevenue: true,
createdAt: true, createdAt: true,
address: { addressStreet1: true }, address: { addressStreet1: true },
@ -136,6 +145,11 @@ linkedinLink
secondaryLinks secondaryLinks
} }
domainName domainName
{
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue annualRecurringRevenue
{ {
amountMicros amountMicros

View File

@ -61,6 +61,11 @@ linkedinLink
secondaryLinks secondaryLinks
} }
domainName domainName
{
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue annualRecurringRevenue
{ {
amountMicros amountMicros

View File

@ -5,6 +5,8 @@ import { getLogoUrlFromDomainName } from '~/utils';
import { getImageAbsoluteURI } from '~/utils/image/getImageAbsoluteURI'; import { getImageAbsoluteURI } from '~/utils/image/getImageAbsoluteURI';
import { isDefined } from '~/utils/isDefined'; import { isDefined } from '~/utils/isDefined';
import { Company } from '@/companies/types/Company';
import { getCompanyDomainName } from '@/object-metadata/utils/getCompanyDomainName';
import { getImageIdentifierFieldValue } from './getImageIdentifierFieldValue'; import { getImageIdentifierFieldValue } from './getImageIdentifierFieldValue';
export const getAvatarUrl = ( export const getAvatarUrl = (
@ -17,7 +19,9 @@ export const getAvatarUrl = (
} }
if (objectNameSingular === CoreObjectNameSingular.Company) { if (objectNameSingular === CoreObjectNameSingular.Company) {
return getLogoUrlFromDomainName(record.domainName ?? ''); return getLogoUrlFromDomainName(
getCompanyDomainName(record as Company) ?? '',
);
} }
if (objectNameSingular === CoreObjectNameSingular.Person) { if (objectNameSingular === CoreObjectNameSingular.Person) {

View File

@ -0,0 +1,14 @@
import { Company } from '@/companies/types/Company';
import { isDefined } from 'twenty-ui';
// temporary, to remove once domainName has been fully migrated to Links type
export const getCompanyDomainName = (company: Company) => {
if (!isDefined(company.domainName)) {
return company.domainName;
}
if (typeof company.domainName === 'string') {
return company.domainName;
} else {
return company.domainName.primaryLinkUrl;
}
};

View File

@ -2940,7 +2940,7 @@ export const getObjectMetadataItemsMock = () => {
{ {
__typename: 'field', __typename: 'field',
id: '20202020-5e4e-4007-a630-8a2617914889', id: '20202020-5e4e-4007-a630-8a2617914889',
type: 'TEXT', type: 'LINKS',
name: 'domainName', name: 'domainName',
label: 'Domain Name', label: 'Domain Name',
description: description:

View File

@ -85,6 +85,11 @@ export type AddressFilter = {
addressPostcode?: StringFilter; addressPostcode?: StringFilter;
}; };
export type LinksFilter = {
primaryLinkUrl?: StringFilter;
primaryLinkLabel?: StringFilter;
};
export type LeafFilter = export type LeafFilter =
| UUIDFilter | UUIDFilter
| StringFilter | StringFilter
@ -95,6 +100,7 @@ export type LeafFilter =
| FullNameFilter | FullNameFilter
| BooleanFilter | BooleanFilter
| AddressFilter | AddressFilter
| LinksFilter
| undefined; | undefined;
export type AndObjectRecordFilter = { export type AndObjectRecordFilter = {

View File

@ -36,7 +36,11 @@ const mocks: MockedResponse[] = [
primaryLinkLabel primaryLinkLabel
secondaryLinks secondaryLinks
} }
domainName domainName {
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue { annualRecurringRevenue {
amountMicros amountMicros
currencyCode currencyCode

View File

@ -3,7 +3,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql';
export const fieldValue = [ export const fieldValue = [
{ {
__typename: 'Company', __typename: 'Company',
domainName: 'google.com', domainName: { primaryLinkUrl: 'google.com', primaryLinkLabel: '' },
xLink: { xLink: {
__typename: 'Link', __typename: 'Link',
primaryLinkLabel: '', primaryLinkLabel: '',
@ -31,7 +31,7 @@ export const fieldValue = [
}, },
{ {
__typename: 'Company', __typename: 'Company',
domainName: 'airbnb.com', domainName: { primaryLinkUrl: 'airbnb.com', primaryLinkLabel: '' },
xLink: { xLink: {
__typename: 'Link', __typename: 'Link',
primaryLinkLabel: '', primaryLinkLabel: '',
@ -69,7 +69,7 @@ export const otherPersonMock = {
createdAt: '2024-05-01T13:16:29.046Z', createdAt: '2024-05-01T13:16:29.046Z',
company: { company: {
__typename: 'Company', __typename: 'Company',
domainName: 'google.com', domainName: { primaryLinkUrl: 'google.com', primaryLinkLabel: '' },
xLink: { xLink: {
__typename: 'Link', __typename: 'Link',
primaryLinkLabel: '', primaryLinkLabel: '',
@ -125,7 +125,7 @@ export const relationFromManyFieldDisplayMock = {
createdAt: '2024-05-01T13:16:29.046Z', createdAt: '2024-05-01T13:16:29.046Z',
company: { company: {
__typename: 'Company', __typename: 'Company',
domainName: 'google.com', domainName: { primaryLinkUrl: 'google.com', primaryLinkLabel: '' },
xLink: { xLink: {
__typename: 'Link', __typename: 'Link',
primaryLinkLabel: '', primaryLinkLabel: '',
@ -169,7 +169,10 @@ export const relationFromManyFieldDisplayMock = {
}, },
relationFieldValue: { relationFieldValue: {
__typename: 'Company', __typename: 'Company',
domainName: 'microsoft.com', domainName: {
primaryLinkLabel: '',
primaryLinkUrl: 'microsoft.com',
},
xLink: { xLink: {
__typename: 'Link', __typename: 'Link',
primaryLinkLabel: '', primaryLinkLabel: '',

View File

@ -2,6 +2,8 @@ import { RecordGqlOperationFilter } from '@/object-record/graphql/types/RecordGq
import { getCompaniesMock } from '~/testing/mock-data/companies'; import { getCompaniesMock } from '~/testing/mock-data/companies';
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/objectMetadataItems'; import { generatedMockObjectMetadataItems } from '~/testing/mock-data/objectMetadataItems';
import { Company } from '@/companies/types/Company';
import { getCompanyDomainName } from '@/object-metadata/utils/getCompanyDomainName';
import { isRecordMatchingFilter } from './isRecordMatchingFilter'; import { isRecordMatchingFilter } from './isRecordMatchingFilter';
const companiesMock = getCompaniesMock(); const companiesMock = getCompaniesMock();
@ -123,10 +125,19 @@ describe('isRecordMatchingFilter', () => {
const companyMockNotInFilter = { const companyMockNotInFilter = {
...companiesMock[0], ...companiesMock[0],
domainName: companyMockInFilter.domainName + 'Different', domainName: {
primaryLinkUrl:
getCompanyDomainName(companyMockInFilter as Company) + 'Different',
},
}; };
const filter = { domainName: { eq: companyMockInFilter.domainName } }; const filter = {
domainName: {
primaryLinkUrl: {
eq: getCompanyDomainName(companyMockInFilter as Company),
},
},
};
expect( expect(
isRecordMatchingFilter({ isRecordMatchingFilter({
@ -228,7 +239,9 @@ describe('isRecordMatchingFilter', () => {
and: [ and: [
{ {
domainName: { domainName: {
eq: companyMockInFilter.domainName, primaryLinkUrl: {
eq: getCompanyDomainName(companyMockInFilter as Company),
},
}, },
}, },
{ {
@ -317,14 +330,23 @@ describe('isRecordMatchingFilter', () => {
const companyMockNotInFilter = { const companyMockNotInFilter = {
...companiesMock[0], ...companiesMock[0],
domainName: companyMockInFilter.domainName + 'Different', domainName: {
primaryLinkUrl:
getCompanyDomainName(companyMockInFilter as Company) + 'Different',
},
employees: 5, employees: 5,
name: companyMockInFilter.name + 'Different', name: companyMockInFilter.name + 'Different',
}; };
const filter: RecordGqlOperationFilter = { const filter: RecordGqlOperationFilter = {
and: [ and: [
{ domainName: { eq: companyMockInFilter.domainName } }, {
domainName: {
primaryLinkUrl: {
eq: getCompanyDomainName(companyMockInFilter as Company),
},
},
},
{ {
or: [ or: [
{ employees: { eq: companyMockInFilter.employees } }, { employees: { eq: companyMockInFilter.employees } },
@ -478,13 +500,17 @@ describe('isRecordMatchingFilter', () => {
const companyMockNotInFilter = { const companyMockNotInFilter = {
...companiesMock[0], ...companiesMock[0],
name: companyMockInFilter.name + 'Different', name: companyMockInFilter.name + 'Different',
domainName: companyMockInFilter.name + 'Different', domainName: { primaryLinkUrl: companyMockInFilter.name + 'Different' },
}; };
const filter = { const filter = {
or: { or: {
name: { eq: companyMockInFilter.name }, name: { eq: companyMockInFilter.name },
domainName: { eq: companyMockInFilter.domainName }, domainName: {
primaryLinkUrl: {
eq: getCompanyDomainName(companyMockInFilter as Company),
},
},
}, },
}; };

View File

@ -9,6 +9,7 @@ import {
DateFilter, DateFilter,
FloatFilter, FloatFilter,
FullNameFilter, FullNameFilter,
LinksFilter,
NotObjectRecordFilter, NotObjectRecordFilter,
OrObjectRecordFilter, OrObjectRecordFilter,
RecordGqlOperationFilter, RecordGqlOperationFilter,
@ -207,6 +208,23 @@ export const isRecordMatchingFilter = ({
}); });
}); });
} }
case FieldMetadataType.Links: {
const linksFilter = filterValue as LinksFilter;
const keys = ['primaryLinkLabel', 'primaryLinkUrl'] as const;
return keys.some((key) => {
const value = linksFilter[key];
if (value === undefined) {
return false;
}
return isMatchingStringFilter({
stringFilter: value,
value: record[filterKey][key],
});
});
}
case FieldMetadataType.DateTime: { case FieldMetadataType.DateTime: {
return isMatchingDateFilter({ return isMatchingDateFilter({
dateFilter: filterValue as DateFilter, dateFilter: filterValue as DateFilter,

View File

@ -36,7 +36,11 @@ const companyMocks = [
primaryLinkLabel primaryLinkLabel
secondaryLinks secondaryLinks
} }
domainName domainName {
primaryLinkUrl
primaryLinkLabel
secondaryLinks
}
annualRecurringRevenue { annualRecurringRevenue {
amountMicros amountMicros
currencyCode currencyCode
@ -64,7 +68,6 @@ const companyMocks = [
variables: { variables: {
data: [ data: [
{ {
domainName: 'example.com',
employees: 0, employees: 0,
idealCustomerProfile: true, idealCustomerProfile: true,
name: 'Example Company', name: 'Example Company',
@ -157,7 +160,6 @@ describe('useSpreadsheetCompanyImport', () => {
{ {
id: companyId, id: companyId,
name: 'Example Company', name: 'Example Company',
domainName: 'example.com',
idealCustomerProfile: true, idealCustomerProfile: true,
employees: '0', employees: '0',
}, },
@ -167,7 +169,6 @@ describe('useSpreadsheetCompanyImport', () => {
{ {
id: companyId, id: companyId,
name: 'Example Company', name: 'Example Company',
domainName: 'example.com',
__index: 'cbc3985f-dde9-46d1-bae2-c124141700ac', __index: 'cbc3985f-dde9-46d1-bae2-c124141700ac',
idealCustomerProfile: true, idealCustomerProfile: true,
employees: '0', employees: '0',

View File

@ -2,6 +2,7 @@ import {
FieldAddressValue, FieldAddressValue,
FieldCurrencyValue, FieldCurrencyValue,
FieldFullNameValue, FieldFullNameValue,
FieldLinksValue,
} from '@/object-record/record-field/types/FieldMetadata'; } from '@/object-record/record-field/types/FieldMetadata';
import { CompositeFieldLabels } from '@/object-record/spreadsheet-import/types/CompositeFieldLabels'; import { CompositeFieldLabels } from '@/object-record/spreadsheet-import/types/CompositeFieldLabels';
import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldMetadataType } from '~/generated-metadata/graphql';
@ -25,4 +26,8 @@ export const COMPOSITE_FIELD_IMPORT_LABELS = {
addressLatLabel: 'Latitude', addressLatLabel: 'Latitude',
addressLngLabel: 'Longitude', addressLngLabel: 'Longitude',
} satisfies CompositeFieldLabels<FieldAddressValue>, } satisfies CompositeFieldLabels<FieldAddressValue>,
[FieldMetadataType.Links]: {
primaryLinkUrlLabel: 'Link URL',
primaryLinkLabelLabel: 'Link Label',
} satisfies Partial<CompositeFieldLabels<FieldLinksValue>>,
}; };

View File

@ -105,6 +105,24 @@ export const useBuildAvailableFieldsForImport = () => {
), ),
}); });
}); });
} else if (fieldMetadataItem.type === FieldMetadataType.Links) {
Object.entries(
COMPOSITE_FIELD_IMPORT_LABELS[FieldMetadataType.Links],
).forEach(([_, fieldLabel]) => {
availableFieldsForImport.push({
icon: getIcon(fieldMetadataItem.icon),
label: `${fieldLabel} (${fieldMetadataItem.label})`,
key: `${fieldLabel} (${fieldMetadataItem.name})`,
fieldType: {
type: 'input',
},
fieldValidationDefinitions:
getSpreadSheetFieldValidationDefinitions(
fieldMetadataItem.type,
`${fieldLabel} (${fieldMetadataItem.label})`,
),
});
});
} else { } else {
availableFieldsForImport.push({ availableFieldsForImport.push({
icon: getIcon(fieldMetadataItem.icon), icon: getIcon(fieldMetadataItem.icon),

View File

@ -1,5 +1,8 @@
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { FieldAddressValue } from '@/object-record/record-field/types/FieldMetadata'; import {
FieldAddressValue,
FieldLinksValue,
} from '@/object-record/record-field/types/FieldMetadata';
import { COMPOSITE_FIELD_IMPORT_LABELS } from '@/object-record/spreadsheet-import/constants/CompositeFieldImportLabels'; import { COMPOSITE_FIELD_IMPORT_LABELS } from '@/object-record/spreadsheet-import/constants/CompositeFieldImportLabels';
import { ImportedStructuredRow } from '@/spreadsheet-import/types'; import { ImportedStructuredRow } from '@/spreadsheet-import/types';
import { isNonEmptyString } from '@sniptt/guards'; import { isNonEmptyString } from '@sniptt/guards';
@ -27,6 +30,7 @@ export const buildRecordFromImportedStructuredRow = (
}, },
CURRENCY: { amountMicrosLabel, currencyCodeLabel }, CURRENCY: { amountMicrosLabel, currencyCodeLabel },
FULL_NAME: { firstNameLabel, lastNameLabel }, FULL_NAME: { firstNameLabel, lastNameLabel },
LINKS: { primaryLinkLabelLabel, primaryLinkUrlLabel },
} = COMPOSITE_FIELD_IMPORT_LABELS; } = COMPOSITE_FIELD_IMPORT_LABELS;
for (const field of fields) { for (const field of fields) {
@ -106,6 +110,25 @@ export const buildRecordFromImportedStructuredRow = (
} }
break; break;
} }
case FieldMetadataType.Links: {
if (
isDefined(
importedStructuredRow[`${primaryLinkUrlLabel} (${field.name})`] ||
importedStructuredRow[`${primaryLinkLabelLabel} (${field.name})`],
)
) {
recordToBuild[field.name] = {
primaryLinkLabel: castToString(
importedStructuredRow[`${primaryLinkLabelLabel} (${field.name})`],
),
primaryLinkUrl: castToString(
importedStructuredRow[`${primaryLinkUrlLabel} (${field.name})`],
),
secondaryLinks: null,
} satisfies FieldLinksValue;
}
break;
}
case FieldMetadataType.Link: case FieldMetadataType.Link:
if (importedFieldValue !== undefined) { if (importedFieldValue !== undefined) {
recordToBuild[field.name] = { recordToBuild[field.name] = {

View File

@ -1,6 +1,5 @@
import { isString } from '@sniptt/guards'; import { isString } from '@sniptt/guards';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { isFieldRelationToOneValue } from '@/object-record/record-field/types/guards/isFieldRelationToOneValue'; import { isFieldRelationToOneValue } from '@/object-record/record-field/types/guards/isFieldRelationToOneValue';
import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { ObjectRecord } from '@/object-record/types/ObjectRecord';
@ -47,13 +46,14 @@ export const sanitizeRecordInput = ({
.filter(isDefined), .filter(isDefined),
); );
if ( if (
objectMetadataItem.nameSingular !== CoreObjectNameSingular.Company || !(
!isString(filteredResultRecord.domainName) isDefined(filteredResultRecord.domainName) &&
isString(filteredResultRecord.domainName)
)
) )
return filteredResultRecord; return filteredResultRecord;
return { return {
...filteredResultRecord, ...filteredResultRecord,
domainName: getUrlHostName(filteredResultRecord.domainName), domainName: getUrlHostName(filteredResultRecord.domainName as string),
}; };
}; };

View File

@ -10,7 +10,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COLUMN_DEFINITIONS = (
fieldMetadataId: '20202020-5e4e-4007-a630-8a2617914889', fieldMetadataId: '20202020-5e4e-4007-a630-8a2617914889',
label: 'Domain Name', label: 'Domain Name',
size: 100, size: 100,
type: FieldMetadataType.Text, type: FieldMetadataType.Links,
metadata: { metadata: {
fieldName: 'domainName', fieldName: 'domainName',
placeHolder: 'Domain Name', placeHolder: 'Domain Name',

View File

@ -2,7 +2,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '04b2e9f5-0713-40a5-8216-82802401d33e', id: '04b2e9f5-0713-40a5-8216-82802401d33e',
domainName: 'qonto.com', domainName: { primarlyLinkUrl: 'qonto.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 1400, employees: 1400,
name: 'Qonto', name: 'Qonto',
@ -112,7 +112,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '0d940997-c21e-4ec2-873b-de4264d89025', id: '0d940997-c21e-4ec2-873b-de4264d89025',
domainName: 'google.com', domainName: { primarlyLinkUrl: 'google.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 72_000, employees: 72_000,
name: 'Google', name: 'Google',
@ -316,7 +316,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '118995f3-5d81-46d6-bf83-f7fd33ea6102', id: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
domainName: 'facebook.com', domainName: { primarlyLinkUrl: 'facebook.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 87_000, employees: 87_000,
name: 'Facebook', name: 'Facebook',
@ -450,7 +450,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944', id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
domainName: 'netflix.com', domainName: { primarlyLinkUrl: 'netflix.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 3_000, employees: 3_000,
name: 'Netflix', name: 'Netflix',
@ -503,7 +503,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '460b6fb1-ed89-413a-b31a-962986e67bb4', id: '460b6fb1-ed89-413a-b31a-962986e67bb4',
domainName: 'microsoft.com', domainName: { primarlyLinkUrl: 'microsoft.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 221_000, employees: 221_000,
name: 'Microsoft', name: 'Microsoft',
@ -686,7 +686,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '7a93d1e5-3f74-492d-a101-2a70f50a1645', id: '7a93d1e5-3f74-492d-a101-2a70f50a1645',
domainName: 'libeo.io', domainName: { primarlyLinkUrl: 'libeo.io', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 50, employees: 50,
name: 'Libeo', name: 'Libeo',
@ -738,7 +738,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '89bb825c-171e-4bcc-9cf7-43448d6fb278', id: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
domainName: 'airbnb.com', domainName: { primarlyLinkUrl: 'airbnb.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 6_000, employees: 6_000,
name: 'Airbnb', name: 'Airbnb',
@ -791,7 +791,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: '9d162de6-cfbf-4156-a790-e39854dcd4eb', id: '9d162de6-cfbf-4156-a790-e39854dcd4eb',
domainName: 'claap.io', domainName: { primarlyLinkUrl: 'claap.io', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 7, employees: 7,
name: 'Claap', name: 'Claap',
@ -845,7 +845,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d', id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
domainName: 'algolia.com', domainName: { primarlyLinkUrl: 'algolia.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 250, employees: 250,
name: 'Algolia', name: 'Algolia',
@ -930,7 +930,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678', id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
domainName: 'samsung.com', domainName: { primarlyLinkUrl: 'samsung.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 400_000, employees: 400_000,
name: 'Samsung', name: 'Samsung',
@ -1013,7 +1013,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: 'aaffcfbd-f86b-419f-b794-02319abe8637', id: 'aaffcfbd-f86b-419f-b794-02319abe8637',
domainName: 'hasura.io', domainName: { primarlyLinkUrl: 'hasura.io', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 17_000, employees: 17_000,
name: 'Hasura', name: 'Hasura',
@ -1067,7 +1067,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: 'f33dc242-5518-4553-9433-42d8eb82834b', id: 'f33dc242-5518-4553-9433-42d8eb82834b',
domainName: 'wework.com', domainName: { primarlyLinkUrl: 'wework.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 2_000, employees: 2_000,
name: 'Wework', name: 'Wework',
@ -1118,7 +1118,7 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
{ {
__typename: 'Company', __typename: 'Company',
id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408', id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
domainName: 'linkedin.com', domainName: { primarlyLinkUrl: 'linkedin.com', primaryLinkLabel: '' },
updatedAt: '2023-11-23T15:38:03.699Z', updatedAt: '2023-11-23T15:38:03.699Z',
employees: 20_000, employees: 20_000,
name: 'Linkedin', name: 'Linkedin',

View File

@ -5,7 +5,7 @@ export const SIGN_IN_BACKGROUND_MOCK_FILTER_DEFINITIONS = [
fieldMetadataId: '20202020-5e4e-4007-a630-8a2617914889', fieldMetadataId: '20202020-5e4e-4007-a630-8a2617914889',
label: 'Domain Name', label: 'Domain Name',
iconName: 'IconLink', iconName: 'IconLink',
type: 'TEXT', type: 'LINKS',
}, },
{ {
fieldMetadataId: '20202020-7fbd-41ad-b64d-25a15ff62f04', fieldMetadataId: '20202020-7fbd-41ad-b64d-25a15ff62f04',

View File

@ -23,7 +23,10 @@ export const USER_QUERY_FRAGMENT = gql`
id id
displayName displayName
logo logo
domainName domainName {
primaryLinkUrl
primaryLinkLabel
}
inviteHash inviteHash
allowImpersonation allowImpersonation
activationStatus activationStatus

View File

@ -110,7 +110,10 @@ export const mockedActivities: Array<MockedActivity> = [
__typename: 'Company', __typename: 'Company',
id: '89bb825c-171e-4bcc-9cf7-43448d6fb280', id: '89bb825c-171e-4bcc-9cf7-43448d6fb280',
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainName: {
primaryLinkLabel: '',
primaryLinkUrl: 'https://www.airbnb.com',
},
}, },
person: null, person: null,
activityId: '89bb825c-171e-4bcc-9cf7-43448d6fb230', activityId: '89bb825c-171e-4bcc-9cf7-43448d6fb230',

View File

@ -13,7 +13,12 @@ export const getEmptyCompanyMock = () => {
return { return {
id: '9231e6ee-4cc2-4c7b-8c55-dff16f4d968a', id: '9231e6ee-4cc2-4c7b-8c55-dff16f4d968a',
name: '', name: '',
domainName: '', domainName: {
__typename: 'Links',
primaryLinkUrl: '',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
accountOwner: null, accountOwner: null,
createdAt: null, createdAt: null,
@ -51,17 +56,22 @@ export const companiesQueryResult = {
name: 'Linkedin', name: 'Linkedin',
accountOwnerId: null, accountOwnerId: null,
accountOwner: null, accountOwner: null,
domainName: 'linkedin.com', domainName: {
__typename: 'Links',
primaryLinkLabel: 'https://linkedin.com',
primaryLinkUrl: '',
secondaryLinks: null,
},
address: '', address: '',
position: 1, position: 1,
idealCustomerProfile: true, idealCustomerProfile: true,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -97,7 +107,7 @@ export const companiesQueryResult = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -113,7 +123,7 @@ export const companiesQueryResult = {
lastName: 'Duss', lastName: 'Duss',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -129,7 +139,7 @@ export const companiesQueryResult = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -149,7 +159,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'facebook.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://facebook.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -159,12 +174,12 @@ export const companiesQueryResult = {
}, },
position: 2, position: 2,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -183,7 +198,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'qonto.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://qonto.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -193,12 +213,12 @@ export const companiesQueryResult = {
}, },
position: 3, position: 3,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -217,7 +237,12 @@ export const companiesQueryResult = {
idealCustomerProfile: true, idealCustomerProfile: true,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'microsoft.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://microsoft.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -227,12 +252,12 @@ export const companiesQueryResult = {
}, },
position: 4, position: 4,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -251,7 +276,12 @@ export const companiesQueryResult = {
idealCustomerProfile: true, idealCustomerProfile: true,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'airbnb.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://airbnb.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -261,12 +291,12 @@ export const companiesQueryResult = {
}, },
position: 5, position: 5,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -285,7 +315,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'google.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://google.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -295,12 +330,12 @@ export const companiesQueryResult = {
}, },
position: 6, position: 6,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -319,7 +354,12 @@ export const companiesQueryResult = {
idealCustomerProfile: true, idealCustomerProfile: true,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'netflix.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://netflix.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -329,12 +369,12 @@ export const companiesQueryResult = {
}, },
position: 7, position: 7,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -353,7 +393,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'libeo.io', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://libeo.io',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -363,12 +408,12 @@ export const companiesQueryResult = {
}, },
position: 8, position: 8,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -387,7 +432,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'claap.io', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://claap.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -397,12 +447,12 @@ export const companiesQueryResult = {
}, },
position: 9, position: 9,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -421,7 +471,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'hasura.io', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://hasura.io',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -431,12 +486,12 @@ export const companiesQueryResult = {
}, },
position: 10, position: 10,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -455,7 +510,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'wework.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://wework.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -465,12 +525,12 @@ export const companiesQueryResult = {
}, },
position: 11, position: 11,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -489,7 +549,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'samsung.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://samsung.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -499,12 +564,12 @@ export const companiesQueryResult = {
}, },
position: 12, position: 12,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -523,7 +588,12 @@ export const companiesQueryResult = {
idealCustomerProfile: false, idealCustomerProfile: false,
accountOwner: null, accountOwner: null,
accountOwnerId: null, accountOwnerId: null,
domainName: 'algolia.com', domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://algolia.com',
primaryLinkLabel: '',
secondaryLinks: null,
},
address: '', address: '',
previousEmployees: null, previousEmployees: null,
annualRecurringRevenue: { annualRecurringRevenue: {
@ -533,12 +603,12 @@ export const companiesQueryResult = {
}, },
position: 13, position: 13,
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },

View File

@ -938,7 +938,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
"node": { "node": {
"__typename": "field", "__typename": "field",
"id": "6b97ae7c-9b97-4a8f-885b-7f8ee3122a7d", "id": "6b97ae7c-9b97-4a8f-885b-7f8ee3122a7d",
"type": "TEXT", "type": "LINKS",
"name": "domainName", "name": "domainName",
"label": "Domain Name", "label": "Domain Name",
"description": "The company website URL. We use this url to fetch the company icon", "description": "The company website URL. We use this url to fetch the company icon",

View File

@ -64,7 +64,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -93,7 +93,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Callisto', lastName: 'Callisto',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -109,7 +109,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'singlelink.com', primaryLinkUrl: 'singlelink.com',
}, },
@ -123,11 +123,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Algolia', name: 'Algolia',
domainName: 'algolia.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'algolia.com',
},
address: '', address: '',
position: 13, position: 13,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -137,7 +141,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -152,11 +156,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Linkedin', name: 'Linkedin',
domainName: 'linkedin.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com',
},
address: '', address: '',
position: 1, position: 1,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -166,7 +174,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -199,7 +207,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -220,7 +228,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Palmer', lastName: 'Palmer',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -236,7 +244,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -250,11 +258,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Linkedin', name: 'Linkedin',
domainName: 'linkedin.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com',
},
address: '', address: '',
position: 1, position: 1,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -264,7 +276,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -297,7 +309,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -313,7 +325,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Gonzalez', lastName: 'Gonzalez',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -329,7 +341,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -343,11 +355,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Qonto', name: 'Qonto',
domainName: 'qonto.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'qonto.com',
},
address: '', address: '',
position: 3, position: 3,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -357,7 +373,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -390,7 +406,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -406,7 +422,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Parker', lastName: 'Parker',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -422,7 +438,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -436,11 +452,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Qonto', name: 'Qonto',
domainName: 'qonto.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'qonto.com',
},
address: '', address: '',
position: 3, position: 3,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -450,7 +470,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -483,7 +503,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -499,7 +519,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Wright', lastName: 'Wright',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -515,7 +535,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -529,11 +549,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Microsoft', name: 'Microsoft',
domainName: 'microsoft.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'microsoft.com',
},
address: '', address: '',
position: 4, position: 4,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -543,7 +567,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -576,7 +600,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -592,7 +616,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Scott', lastName: 'Scott',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -608,7 +632,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -622,11 +646,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Microsoft', name: 'Microsoft',
domainName: 'microsoft.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'microsoft.com',
},
address: '', address: '',
position: 4, position: 4,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -636,7 +664,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -669,7 +697,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -685,7 +713,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Green', lastName: 'Green',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -701,7 +729,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -715,11 +743,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Microsoft', name: 'Microsoft',
domainName: 'microsoft.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'microsoft.com',
},
address: '', address: '',
position: 4, position: 4,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -729,7 +761,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -762,7 +794,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -778,7 +810,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Baker', lastName: 'Baker',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -794,7 +826,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -808,11 +840,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'airbnb.com',
},
address: '', address: '',
position: 5, position: 5,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -822,7 +858,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -855,7 +891,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -871,7 +907,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Nelson', lastName: 'Nelson',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -887,7 +923,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -901,11 +937,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'airbnb.com',
},
address: '', address: '',
position: 5, position: 5,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -915,7 +955,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -948,7 +988,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -964,7 +1004,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Carter', lastName: 'Carter',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -980,7 +1020,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -994,11 +1034,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'airbnb.com',
},
address: '', address: '',
position: 5, position: 5,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1008,7 +1052,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1041,7 +1085,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -1057,7 +1101,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Mitchell', lastName: 'Mitchell',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -1073,7 +1117,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1087,11 +1131,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Google', name: 'Google',
domainName: 'google.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'google.com',
},
address: '', address: '',
position: 6, position: 6,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1101,7 +1149,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1134,7 +1182,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1150,7 +1198,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Perez', lastName: 'Perez',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -1166,7 +1214,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1180,11 +1228,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Google', name: 'Google',
domainName: 'google.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'google.com',
},
address: '', address: '',
position: 6, position: 6,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1194,7 +1246,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1227,7 +1279,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1243,7 +1295,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Voulzy', lastName: 'Voulzy',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -1259,7 +1311,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1273,11 +1325,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Google', name: 'Google',
domainName: 'google.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'google.com',
},
address: '', address: '',
position: 6, position: 6,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1287,7 +1343,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1320,7 +1376,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com', primaryLinkUrl: 'twitter.com',
}, },
@ -1336,7 +1392,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Duss', lastName: 'Duss',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -1352,7 +1408,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1366,11 +1422,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Google', name: 'Google',
domainName: 'google.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'google.com',
},
address: '', address: '',
position: 6, position: 6,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1380,7 +1440,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1413,7 +1473,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: 'USD', currencyCode: 'USD',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1429,7 +1489,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
lastName: 'Vladim', lastName: 'Vladim',
}, },
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com', primaryLinkUrl: 'linkedin.com',
}, },
@ -1445,7 +1505,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
addressLng: null, addressLng: null,
}, },
testLink: { testLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1459,11 +1519,15 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
idealCustomerProfile: false, idealCustomerProfile: false,
createdAt: '2024-06-05T09:00:20.412Z', createdAt: '2024-06-05T09:00:20.412Z',
name: 'Google', name: 'Google',
domainName: 'google.com', domainName: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'google.com',
},
address: '', address: '',
position: 6, position: 6,
linkedinLink: { linkedinLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },
@ -1473,7 +1537,7 @@ export const peopleQueryResult: { people: RecordGqlConnection } = {
currencyCode: '', currencyCode: '',
}, },
xLink: { xLink: {
__typename: 'Link', __typename: 'Links',
primaryLinkLabel: '', primaryLinkLabel: '',
primaryLinkUrl: '', primaryLinkUrl: '',
}, },

View File

@ -0,0 +1,302 @@
import { Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import chalk from 'chalk';
import { Command, CommandRunner, Option } from 'nest-commander';
import { QueryRunner, Repository } from 'typeorm';
import { TypeORMService } from 'src/database/typeorm/typeorm.service';
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
import { CreateFieldInput } from 'src/engine/metadata-modules/field-metadata/dtos/create-field.input';
import {
FieldMetadataEntity,
FieldMetadataType,
} from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { FieldMetadataService } from 'src/engine/metadata-modules/field-metadata/field-metadata.service';
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
import { WorkspaceStatusService } from 'src/engine/workspace-manager/workspace-status/services/workspace-status.service';
import { COMPANY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
import { ViewService } from 'src/modules/view/services/view.service';
import { ViewFieldWorkspaceEntity } from 'src/modules/view/standard-objects/view-field.workspace-entity';
interface MigrateDomainNameFromTextToLinksCommandOptions {
workspaceId?: string;
}
@Command({
name: 'migrate-0.23:migrate-domain-standard-field-to-links',
description:
'Migrating field domainName of deprecated type TEXT to type LINKS',
})
export class MigrateDomainNameFromTextToLinksCommand extends CommandRunner {
private readonly logger = new Logger(
MigrateDomainNameFromTextToLinksCommand.name,
);
constructor(
@InjectRepository(FieldMetadataEntity, 'metadata')
private readonly fieldMetadataRepository: Repository<FieldMetadataEntity>,
private readonly fieldMetadataService: FieldMetadataService,
private readonly twentyORMGlobalManager: TwentyORMGlobalManager,
private readonly typeORMService: TypeORMService,
private readonly dataSourceService: DataSourceService,
private readonly workspaceStatusService: WorkspaceStatusService,
private readonly viewService: ViewService,
) {
super();
}
@Option({
flags: '-w, --workspace-id [workspace_id]',
description:
'workspace id. Command runs on all active workspaces if not provided',
required: false,
})
parseWorkspaceId(value: string): string {
return value;
}
async run(
_passedParam: string[],
options: MigrateDomainNameFromTextToLinksCommandOptions,
): Promise<void> {
this.logger.log(
'Running command to migrate standard field domainName from text to Link',
);
let workspaceIds: string[] = [];
if (options.workspaceId) {
workspaceIds = [options.workspaceId];
} else {
const activeWorkspaceIds =
await this.workspaceStatusService.getActiveWorkspaceIds();
workspaceIds = activeWorkspaceIds;
}
if (!workspaceIds.length) {
this.logger.log(chalk.yellow('No workspace found'));
return;
} else {
this.logger.log(
chalk.green(`Running command on ${workspaceIds.length} workspaces`),
);
}
for (const workspaceId of workspaceIds) {
this.logger.log(`Running command for workspace ${workspaceId}`);
try {
const dataSourceMetadata =
await this.dataSourceService.getLastDataSourceMetadataFromWorkspaceId(
workspaceId,
);
if (!dataSourceMetadata) {
throw new Error(
`Could not find dataSourceMetadata for workspace ${workspaceId}`,
);
}
const workspaceDataSource =
await this.typeORMService.connectToDataSource(dataSourceMetadata);
if (!workspaceDataSource) {
throw new Error(
`Could not connect to dataSource for workspace ${workspaceId}`,
);
}
const domainNameField = await this.fieldMetadataRepository.findOneBy({
workspaceId,
standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
});
if (!domainNameField) {
throw new Error('Could not find domainName field');
}
if (domainNameField.type === FieldMetadataType.LINKS) {
this.logger.log(
`Field domainName is already of type LINKS, skipping migration.`,
);
continue;
}
this.logger.log(`Attempting to migrate domainName field.`);
const workspaceQueryRunner = workspaceDataSource.createQueryRunner();
await workspaceQueryRunner.connect();
const fieldName = domainNameField.name;
const { id: _id, ...domainNameFieldWithoutId } = domainNameField;
try {
const tmpNewDomainLinksField =
await this.fieldMetadataService.createOne({
...domainNameFieldWithoutId,
type: FieldMetadataType.LINKS,
name: `${fieldName}Tmp`,
defaultValue: {
primaryLinkUrl: domainNameField.defaultValue,
secondaryLinks: null,
primaryLinkLabel: "''",
},
} satisfies CreateFieldInput);
// Migrate data from domainName to primaryLinkUrl
await this.migrateDataWithinCompanyTable({
sourceColumnName: `${domainNameField.name}`,
targetColumnName: `${tmpNewDomainLinksField.name}PrimaryLinkUrl`,
workspaceQueryRunner,
dataSourceMetadata,
});
// Duplicate initial domainName text field's views behaviour for new domainName field
await this.viewService.removeFieldFromViews({
workspaceId: workspaceId,
fieldId: tmpNewDomainLinksField.id,
});
const viewFieldRepository =
await this.twentyORMGlobalManager.getRepositoryForWorkspace<ViewFieldWorkspaceEntity>(
workspaceId,
'viewField',
);
const viewFieldsWithDeprecatedField = await viewFieldRepository.find({
where: {
fieldMetadataId: domainNameField.id,
isVisible: true,
},
});
await this.viewService.addFieldToViews({
workspaceId: workspaceId,
fieldId: tmpNewDomainLinksField.id,
viewsIds: viewFieldsWithDeprecatedField
.filter((viewField) => viewField.viewId !== null)
.map((viewField) => viewField.viewId as string),
positions: viewFieldsWithDeprecatedField.reduce(
(acc, viewField) => {
if (!viewField.viewId) {
return acc;
}
acc[viewField.viewId] = viewField.position;
return acc;
},
[],
),
size: 150,
});
// Delete initial domainName text field
await this.fieldMetadataService.deleteOneField(
{ id: domainNameField.id },
workspaceId,
);
// Rename temporary domainName links field
await this.fieldMetadataService.updateOne(tmpNewDomainLinksField.id, {
id: tmpNewDomainLinksField.id,
workspaceId: tmpNewDomainLinksField.workspaceId,
name: `${fieldName}`,
isCustom: false,
});
this.logger.log(`Migration of domainName done!`);
} catch (error) {
this.logger.log(
`Failed to migrate domainName ${domainNameField.id}, rolling back.`,
);
// Re-create initial field if it was deleted
const initialField =
await this.fieldMetadataService.findOneWithinWorkspace(
workspaceId,
{
where: {
name: `${domainNameField.name}`,
objectMetadataId: domainNameField.objectMetadataId,
},
},
);
const tmpNewDomainLinksField =
await this.fieldMetadataService.findOneWithinWorkspace(
workspaceId,
{
where: {
name: `${domainNameField.name}Tmp`,
objectMetadataId: domainNameField.objectMetadataId,
},
},
);
if (!initialField) {
this.logger.log(`Re-creating initial domainName field`);
const restoredField = await this.fieldMetadataService.createOne({
...domainNameField,
});
if (tmpNewDomainLinksField) {
this.logger.log(`Restoring data in domainName`);
await this.migrateDataWithinCompanyTable({
sourceColumnName: `${tmpNewDomainLinksField.name}PrimaryLinkLabel`,
targetColumnName: `${restoredField.name}PrimaryLinkLabel`,
workspaceQueryRunner,
dataSourceMetadata,
});
await this.migrateDataWithinCompanyTable({
sourceColumnName: `${tmpNewDomainLinksField.name}PrimaryLinkUrl`,
targetColumnName: `${restoredField.name}PrimaryLinkUrl`,
workspaceQueryRunner,
dataSourceMetadata,
});
} else {
this.logger.log(
`Failed to restore data in domainName field ${domainNameField.id}`,
);
}
}
if (tmpNewDomainLinksField) {
await this.fieldMetadataService.deleteOneField(
{ id: tmpNewDomainLinksField.id },
workspaceId,
);
}
} finally {
await workspaceQueryRunner.release();
}
} catch (error) {
this.logger.log(
chalk.red(
`Running command on workspace ${workspaceId} failed with error: ${error}`,
),
);
continue;
}
this.logger.log(chalk.green(`Command completed!`));
}
}
private async migrateDataWithinCompanyTable({
sourceColumnName,
targetColumnName,
workspaceQueryRunner,
dataSourceMetadata,
}: {
sourceColumnName: string;
targetColumnName: string;
workspaceQueryRunner: QueryRunner;
dataSourceMetadata: DataSourceEntity;
}) {
await workspaceQueryRunner.query(
`UPDATE "${dataSourceMetadata.schema}"."company" SET "${targetColumnName}" = CASE WHEN "${sourceColumnName}" LIKE 'http%' THEN "${sourceColumnName}" ELSE 'https://' || "${sourceColumnName}" END;`,
);
}
}

View File

@ -1,5 +1,6 @@
import { Command, CommandRunner, Option } from 'nest-commander'; import { Command, CommandRunner, Option } from 'nest-commander';
import { MigrateDomainNameFromTextToLinksCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-domain-to-links.command';
import { MigrateLinkFieldsToLinksCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-link-fields-to-links.command'; import { MigrateLinkFieldsToLinksCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-link-fields-to-links.command';
import { MigrateMessageChannelSyncStatusEnumCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-message-channel-sync-status-enum.command'; import { MigrateMessageChannelSyncStatusEnumCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-message-channel-sync-status-enum.command';
@ -14,6 +15,7 @@ interface Options {
export class UpgradeTo0_23Command extends CommandRunner { export class UpgradeTo0_23Command extends CommandRunner {
constructor( constructor(
private readonly migrateLinkFieldsToLinks: MigrateLinkFieldsToLinksCommand, private readonly migrateLinkFieldsToLinks: MigrateLinkFieldsToLinksCommand,
private readonly migrateDomainNameFromTextToLinks: MigrateDomainNameFromTextToLinksCommand,
private readonly migrateMessageChannelSyncStatusEnumCommand: MigrateMessageChannelSyncStatusEnumCommand, private readonly migrateMessageChannelSyncStatusEnumCommand: MigrateMessageChannelSyncStatusEnumCommand,
) { ) {
super(); super();
@ -31,6 +33,7 @@ export class UpgradeTo0_23Command extends CommandRunner {
async run(_passedParam: string[], options: Options): Promise<void> { async run(_passedParam: string[], options: Options): Promise<void> {
await this.migrateLinkFieldsToLinks.run(_passedParam, options); await this.migrateLinkFieldsToLinks.run(_passedParam, options);
await this.migrateDomainNameFromTextToLinks.run(_passedParam, options);
await this.migrateMessageChannelSyncStatusEnumCommand.run( await this.migrateMessageChannelSyncStatusEnumCommand.run(
_passedParam, _passedParam,
options, options,

View File

@ -1,6 +1,7 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { MigrateDomainNameFromTextToLinksCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-domain-to-links.command';
import { MigrateLinkFieldsToLinksCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-link-fields-to-links.command'; import { MigrateLinkFieldsToLinksCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-link-fields-to-links.command';
import { MigrateMessageChannelSyncStatusEnumCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-message-channel-sync-status-enum.command'; import { MigrateMessageChannelSyncStatusEnumCommand } from 'src/database/commands/upgrade-version/0-23/0-23-migrate-message-channel-sync-status-enum.command';
import { UpgradeTo0_23Command } from 'src/database/commands/upgrade-version/0-23/0-23-upgrade-version.command'; import { UpgradeTo0_23Command } from 'src/database/commands/upgrade-version/0-23/0-23-upgrade-version.command';
@ -28,6 +29,7 @@ import { ViewModule } from 'src/modules/view/view.module';
], ],
providers: [ providers: [
MigrateLinkFieldsToLinksCommand, MigrateLinkFieldsToLinksCommand,
MigrateDomainNameFromTextToLinksCommand,
MigrateMessageChannelSyncStatusEnumCommand, MigrateMessageChannelSyncStatusEnumCommand,
UpgradeTo0_23Command, UpgradeTo0_23Command,
], ],

View File

@ -28,7 +28,7 @@ export const seedCompanies = async (
.into(`${schemaName}.${tableName}`, [ .into(`${schemaName}.${tableName}`, [
'id', 'id',
'name', 'name',
'domainName', 'domainNamePrimaryLinkUrl',
'addressAddressStreet1', 'addressAddressStreet1',
'addressAddressStreet2', 'addressAddressStreet2',
'addressAddressCity', 'addressAddressCity',
@ -42,7 +42,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.LINKEDIN, id: DEV_SEED_COMPANY_IDS.LINKEDIN,
name: 'Linkedin', name: 'Linkedin',
domainName: 'linkedin.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://linkedin.com' },
addressAddressStreet1: 'Eutaw Street', addressAddressStreet1: 'Eutaw Street',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'Dublin', addressAddressCity: 'Dublin',
@ -54,7 +54,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.FACEBOOK, id: DEV_SEED_COMPANY_IDS.FACEBOOK,
name: 'Facebook', name: 'Facebook',
domainName: 'facebook.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://facebook.com' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -66,7 +66,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.QONTO, id: DEV_SEED_COMPANY_IDS.QONTO,
name: 'Qonto', name: 'Qonto',
domainName: 'qonto.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://qonto.com' },
addressAddressStreet1: '18 rue de navarrin', addressAddressStreet1: '18 rue de navarrin',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'Paris', addressAddressCity: 'Paris',
@ -78,7 +78,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.MICROSOFT, id: DEV_SEED_COMPANY_IDS.MICROSOFT,
name: 'Microsoft', name: 'Microsoft',
domainName: 'microsoft.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://microsoft.com' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -90,7 +90,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.AIRBNB, id: DEV_SEED_COMPANY_IDS.AIRBNB,
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://airbnb.com' },
addressAddressStreet1: '888 Brannan St', addressAddressStreet1: '888 Brannan St',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'San Francisco', addressAddressCity: 'San Francisco',
@ -102,7 +102,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.GOOGLE, id: DEV_SEED_COMPANY_IDS.GOOGLE,
name: 'Google', name: 'Google',
domainName: 'google.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://google.com' },
addressAddressStreet1: '760 Market St', addressAddressStreet1: '760 Market St',
addressAddressStreet2: 'Floor 10', addressAddressStreet2: 'Floor 10',
addressAddressCity: 'San Francisco', addressAddressCity: 'San Francisco',
@ -114,7 +114,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.NETFLIX, id: DEV_SEED_COMPANY_IDS.NETFLIX,
name: 'Netflix', name: 'Netflix',
domainName: 'netflix.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://netflix.com' },
addressAddressStreet1: '2300 Harrison St', addressAddressStreet1: '2300 Harrison St',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'San Francisco', addressAddressCity: 'San Francisco',
@ -126,7 +126,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.LIBEO, id: DEV_SEED_COMPANY_IDS.LIBEO,
name: 'Libeo', name: 'Libeo',
domainName: 'libeo.io', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://libeo.io' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -138,7 +138,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.CLAAP, id: DEV_SEED_COMPANY_IDS.CLAAP,
name: 'Claap', name: 'Claap',
domainName: 'claap.io', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://claap.io' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -150,7 +150,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.HASURA, id: DEV_SEED_COMPANY_IDS.HASURA,
name: 'Hasura', name: 'Hasura',
domainName: 'hasura.io', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://hasura.io' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -162,7 +162,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.WEWORK, id: DEV_SEED_COMPANY_IDS.WEWORK,
name: 'Wework', name: 'Wework',
domainName: 'wework.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://wework.com' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -174,7 +174,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.SAMSUNG, id: DEV_SEED_COMPANY_IDS.SAMSUNG,
name: 'Samsung', name: 'Samsung',
domainName: 'samsung.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://samsung.com' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,
@ -186,7 +186,7 @@ export const seedCompanies = async (
{ {
id: DEV_SEED_COMPANY_IDS.ALGOLIA, id: DEV_SEED_COMPANY_IDS.ALGOLIA,
name: 'Algolia', name: 'Algolia',
domainName: 'algolia.com', domainNamePrimaryLinkUrl: { primarlyLinkUrl: 'https://algolia.com' },
addressAddressStreet1: null, addressAddressStreet1: null,
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: null, addressAddressCity: null,

View File

@ -8,7 +8,9 @@ import { ObjectMetadataInterface } from 'src/engine/metadata-modules/field-metad
import { stringifyWithoutKeyQuote } from 'src/engine/api/graphql/workspace-query-builder/utils/stringify-without-key-quote.util'; import { stringifyWithoutKeyQuote } from 'src/engine/api/graphql/workspace-query-builder/utils/stringify-without-key-quote.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service'; import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { IntelligenceService } from 'src/engine/core-modules/quick-actions/intelligence.service'; import { IntelligenceService } from 'src/engine/core-modules/quick-actions/intelligence.service';
import { getCompanyNameFromDomainName } from 'src/modules/contact-creation-manager/utils/get-company-name-from-domain-name.util';
import { capitalize } from 'src/utils/capitalize'; import { capitalize } from 'src/utils/capitalize';
import { getCompanyDomainName } from 'src/utils/getCompanyDomainName';
import { isWorkEmail } from 'src/utils/is-work-email'; import { isWorkEmail } from 'src/utils/is-work-email';
@Injectable() @Injectable()
@ -159,7 +161,7 @@ export class QuickActionsService {
} }
const enrichedData = await this.intelligenceService.enrichCompany( const enrichedData = await this.intelligenceService.enrichCompany(
company.domainName, getCompanyNameFromDomainName(getCompanyDomainName(company)),
); );
await this.workspaceQueryRunnunerService.execute( await this.workspaceQueryRunnunerService.execute(

View File

@ -1,11 +1,12 @@
import { FieldMetadataDefaultValue } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-default-value.interface'; import { FieldMetadataDefaultValue } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-default-value.interface';
import { FieldMetadataOptions } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-options.interface'; import { FieldMetadataOptions } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-options.interface';
import { FieldMetadataSettings } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface';
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity'; import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { generateDefaultValue } from 'src/engine/metadata-modules/field-metadata/utils/generate-default-value';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage'; import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
import { TypedReflect } from 'src/utils/typed-reflect'; import { TypedReflect } from 'src/utils/typed-reflect';
import { generateDefaultValue } from 'src/engine/metadata-modules/field-metadata/utils/generate-default-value';
export interface WorkspaceFieldOptions< export interface WorkspaceFieldOptions<
T extends FieldMetadataType | 'default', T extends FieldMetadataType | 'default',
@ -17,6 +18,7 @@ export interface WorkspaceFieldOptions<
icon?: string; icon?: string;
defaultValue?: FieldMetadataDefaultValue<T>; defaultValue?: FieldMetadataDefaultValue<T>;
options?: FieldMetadataOptions<T>; options?: FieldMetadataOptions<T>;
settings?: FieldMetadataSettings<T>;
} }
export function WorkspaceField<T extends FieldMetadataType>( export function WorkspaceField<T extends FieldMetadataType>(

View File

@ -11,7 +11,7 @@ export const companyPrefillDemoData = async (
.insert() .insert()
.into(`${schemaName}.company`, [ .into(`${schemaName}.company`, [
'name', 'name',
'domainName', 'domainNamePrimaryLinkUrl',
'addressAddressCity', 'addressAddressCity',
'employees', 'employees',
'linkedinLinkPrimaryLinkUrl', 'linkedinLinkPrimaryLinkUrl',

View File

@ -9,7 +9,7 @@ export const companyPrefillData = async (
.insert() .insert()
.into(`${schemaName}.company`, [ .into(`${schemaName}.company`, [
'name', 'name',
'domainName', 'domainNamePrimaryLinkUrl',
'addressAddressStreet1', 'addressAddressStreet1',
'addressAddressStreet2', 'addressAddressStreet2',
'addressAddressCity', 'addressAddressCity',
@ -23,7 +23,7 @@ export const companyPrefillData = async (
.values([ .values([
{ {
name: 'Airbnb', name: 'Airbnb',
domainName: 'airbnb.com', domainNamePrimaryLinkUrl: 'https://airbnb.com',
addressAddressStreet1: '888 Brannan St', addressAddressStreet1: '888 Brannan St',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'San Francisco', addressAddressCity: 'San Francisco',
@ -35,7 +35,7 @@ export const companyPrefillData = async (
}, },
{ {
name: 'Qonto', name: 'Qonto',
domainName: 'qonto.com', domainNamePrimaryLinkUrl: 'https://qonto.com',
addressAddressStreet1: '18 rue de navarrin', addressAddressStreet1: '18 rue de navarrin',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'Paris', addressAddressCity: 'Paris',
@ -47,7 +47,7 @@ export const companyPrefillData = async (
}, },
{ {
name: 'Stripe', name: 'Stripe',
domainName: 'stripe.com', domainNamePrimaryLinkUrl: 'https://stripe.com',
addressAddressStreet1: 'Eutaw Street', addressAddressStreet1: 'Eutaw Street',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'Dublin', addressAddressCity: 'Dublin',
@ -59,7 +59,7 @@ export const companyPrefillData = async (
}, },
{ {
name: 'Figma', name: 'Figma',
domainName: 'figma.com', domainNamePrimaryLinkUrl: 'https://figma.com',
addressAddressStreet1: '760 Market St', addressAddressStreet1: '760 Market St',
addressAddressStreet2: 'Floor 10', addressAddressStreet2: 'Floor 10',
addressAddressCity: 'San Francisco', addressAddressCity: 'San Francisco',
@ -71,7 +71,7 @@ export const companyPrefillData = async (
}, },
{ {
name: 'Notion', name: 'Notion',
domainName: 'notion.com', domainNamePrimaryLinkUrl: 'https://notion.com',
addressAddressStreet1: '2300 Harrison St', addressAddressStreet1: '2300 Harrison St',
addressAddressStreet2: null, addressAddressStreet2: null,
addressAddressCity: 'San Francisco', addressAddressCity: 'San Francisco',

View File

@ -51,10 +51,15 @@ export class SyncWorkspaceMetadataCommand extends CommandRunner {
); );
} }
let count = 1;
const errorsDuringSync: string[] = []; const errorsDuringSync: string[] = [];
for (const workspaceId of workspaceIds) { for (const workspaceId of workspaceIds) {
this.logger.log(`Running workspace sync for workspace: ${workspaceId}`); this.logger.log(
`Running workspace sync for workspace: ${workspaceId} (${count} out of ${workspaceIds.length})`,
);
count++;
try { try {
const issues = const issues =
await this.workspaceHealthService.healthCheck(workspaceId); await this.workspaceHealthService.healthCheck(workspaceId);

View File

@ -20,6 +20,7 @@ export class CompanyRepository {
public async getExistingCompaniesByDomainNames( public async getExistingCompaniesByDomainNames(
domainNames: string[], domainNames: string[],
workspaceId: string, workspaceId: string,
companyDomainNameColumnName: string,
transactionManager?: EntityManager, transactionManager?: EntityManager,
): Promise<{ id: string; domainName: string }[]> { ): Promise<{ id: string; domainName: string }[]> {
const dataSourceSchema = const dataSourceSchema =
@ -27,7 +28,7 @@ export class CompanyRepository {
const existingCompanies = const existingCompanies =
await this.workspaceDataSourceService.executeRawQuery( await this.workspaceDataSourceService.executeRawQuery(
`SELECT id, "domainName" FROM ${dataSourceSchema}.company WHERE "domainName" = ANY($1)`, `SELECT id, "${companyDomainNameColumnName}" AS "domainName" FROM ${dataSourceSchema}.company WHERE REGEXP_REPLACE("${companyDomainNameColumnName}", '^https?://', '') = ANY($1)`,
[domainNames], [domainNames],
workspaceId, workspaceId,
transactionManager, transactionManager,
@ -56,6 +57,7 @@ export class CompanyRepository {
public async createCompany( public async createCompany(
workspaceId: string, workspaceId: string,
companyToCreate: CompanyToCreate, companyToCreate: CompanyToCreate,
companyDomainNameColumnName,
transactionManager?: EntityManager, transactionManager?: EntityManager,
): Promise<void> { ): Promise<void> {
const dataSourceSchema = const dataSourceSchema =
@ -67,11 +69,11 @@ export class CompanyRepository {
); );
await this.workspaceDataSourceService.executeRawQuery( await this.workspaceDataSourceService.executeRawQuery(
`INSERT INTO ${dataSourceSchema}.company (id, "domainName", name, "addressAddressCity", position) `INSERT INTO ${dataSourceSchema}.company (id, "${companyDomainNameColumnName}", name, "addressAddressCity", position)
VALUES ($1, $2, $3, $4, $5)`, VALUES ($1, $2, $3, $4, $5)`,
[ [
companyToCreate.id, companyToCreate.id,
companyToCreate.domainName, 'https://' + companyToCreate.domainName,
companyToCreate.name ?? '', companyToCreate.name ?? '',
companyToCreate.city ?? '', companyToCreate.city ?? '',
lastCompanyPosition + 1, lastCompanyPosition + 1,

View File

@ -48,7 +48,7 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
@WorkspaceField({ @WorkspaceField({
standardId: COMPANY_STANDARD_FIELD_IDS.domainName, standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
type: FieldMetadataType.TEXT, type: FieldMetadataType.LINKS,
label: 'Domain Name', label: 'Domain Name',
description: description:
'The company website URL. We use this url to fetch the company icon', 'The company website URL. We use this url to fetch the company icon',

View File

@ -2,6 +2,7 @@ import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { ObjectMetadataRepositoryModule } from 'src/engine/object-metadata-repository/object-metadata-repository.module'; import { ObjectMetadataRepositoryModule } from 'src/engine/object-metadata-repository/object-metadata-repository.module';
import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module'; import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module';
@ -24,6 +25,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
WorkspaceDataSourceModule, WorkspaceDataSourceModule,
TypeOrmModule.forFeature([FeatureFlagEntity], 'core'), TypeOrmModule.forFeature([FeatureFlagEntity], 'core'),
TypeOrmModule.forFeature([ObjectMetadataEntity], 'metadata'), TypeOrmModule.forFeature([ObjectMetadataEntity], 'metadata'),
TypeOrmModule.forFeature([FieldMetadataEntity], 'metadata'),
], ],
providers: [ providers: [
CreateCompanyService, CreateCompanyService,

View File

@ -7,8 +7,13 @@ import compact from 'lodash.compact';
import { EntityManager, Repository } from 'typeorm'; import { EntityManager, Repository } from 'typeorm';
import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event';
import {
FieldMetadataEntity,
FieldMetadataType,
} from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator';
import { COMPANY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids'; import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
import { CONTACTS_CREATION_BATCH_SIZE } from 'src/modules/contact-creation-manager/constants/contacts-creation-batch-size.constant'; import { CONTACTS_CREATION_BATCH_SIZE } from 'src/modules/contact-creation-manager/constants/contacts-creation-batch-size.constant';
@ -36,12 +41,15 @@ export class CreateCompanyAndContactService {
private readonly eventEmitter: EventEmitter2, private readonly eventEmitter: EventEmitter2,
@InjectRepository(ObjectMetadataEntity, 'metadata') @InjectRepository(ObjectMetadataEntity, 'metadata')
private readonly objectMetadataRepository: Repository<ObjectMetadataEntity>, private readonly objectMetadataRepository: Repository<ObjectMetadataEntity>,
@InjectRepository(FieldMetadataEntity, 'metadata')
private readonly fieldMetadataRepository: Repository<FieldMetadataEntity>,
) {} ) {}
private async createCompaniesAndPeople( private async createCompaniesAndPeople(
connectedAccount: ConnectedAccountWorkspaceEntity, connectedAccount: ConnectedAccountWorkspaceEntity,
contactsToCreate: Contact[], contactsToCreate: Contact[],
workspaceId: string, workspaceId: string,
companyDomainNameColumnName: string,
transactionManager?: EntityManager, transactionManager?: EntityManager,
): Promise<PersonWorkspaceEntity[]> { ): Promise<PersonWorkspaceEntity[]> {
if (!contactsToCreate || contactsToCreate.length === 0) { if (!contactsToCreate || contactsToCreate.length === 0) {
@ -103,6 +111,7 @@ export class CreateCompanyAndContactService {
const companiesObject = await this.createCompaniesService.createCompanies( const companiesObject = await this.createCompaniesService.createCompanies(
domainNamesToCreate, domainNamesToCreate,
workspaceId, workspaceId,
companyDomainNameColumnName,
transactionManager, transactionManager,
); );
@ -146,11 +155,24 @@ export class CreateCompanyAndContactService {
throw new Error('Object metadata not found'); throw new Error('Object metadata not found');
} }
const domainNameFieldMetadata = await this.fieldMetadataRepository.findOne({
where: {
workspaceId: workspaceId,
standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
},
});
const companyDomainNameColumnName =
domainNameFieldMetadata?.type === FieldMetadataType.LINKS
? 'domainNamePrimaryLinkUrl'
: 'domainName';
for (const contactsBatch of contactsBatches) { for (const contactsBatch of contactsBatches) {
const createdPeople = await this.createCompaniesAndPeople( const createdPeople = await this.createCompaniesAndPeople(
connectedAccount, connectedAccount,
contactsBatch, contactsBatch,
workspaceId, workspaceId,
companyDomainNameColumnName,
); );
for (const createdPerson of createdPeople) { for (const createdPerson of createdPeople) {

View File

@ -8,6 +8,7 @@ import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repos
import { CompanyRepository } from 'src/modules/company/repositories/company.repository'; import { CompanyRepository } from 'src/modules/company/repositories/company.repository';
import { CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity'; import { CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity';
import { getCompanyNameFromDomainName } from 'src/modules/contact-creation-manager/utils/get-company-name-from-domain-name.util'; import { getCompanyNameFromDomainName } from 'src/modules/contact-creation-manager/utils/get-company-name-from-domain-name.util';
import { getCompanyDomainName } from 'src/utils/getCompanyDomainName';
@Injectable() @Injectable()
export class CreateCompanyService { export class CreateCompanyService {
private readonly httpService: AxiosInstance; private readonly httpService: AxiosInstance;
@ -24,6 +25,7 @@ export class CreateCompanyService {
async createCompanies( async createCompanies(
domainNames: string[], domainNames: string[],
workspaceId: string, workspaceId: string,
companyDomainNameColumnName: string,
transactionManager?: EntityManager, transactionManager?: EntityManager,
): Promise<{ ): Promise<{
[domainName: string]: string; [domainName: string]: string;
@ -38,6 +40,7 @@ export class CreateCompanyService {
await this.companyRepository.getExistingCompaniesByDomainNames( await this.companyRepository.getExistingCompaniesByDomainNames(
uniqueDomainNames, uniqueDomainNames,
workspaceId, workspaceId,
companyDomainNameColumnName,
transactionManager, transactionManager,
); );
@ -61,7 +64,7 @@ export class CreateCompanyService {
(domainName) => (domainName) =>
!existingCompanies.some( !existingCompanies.some(
(company: { domainName: string }) => (company: { domainName: string }) =>
company.domainName === domainName, getCompanyDomainName(company) === domainName,
), ),
); );
@ -69,6 +72,7 @@ export class CreateCompanyService {
companiesObject[domainName] = await this.createCompany( companiesObject[domainName] = await this.createCompany(
domainName, domainName,
workspaceId, workspaceId,
companyDomainNameColumnName,
transactionManager, transactionManager,
); );
} }
@ -79,6 +83,7 @@ export class CreateCompanyService {
private async createCompany( private async createCompany(
domainName: string, domainName: string,
workspaceId: string, workspaceId: string,
companyDomainNameColumnName,
transactionManager?: EntityManager, transactionManager?: EntityManager,
): Promise<string> { ): Promise<string> {
const companyId = v4(); const companyId = v4();
@ -93,6 +98,7 @@ export class CreateCompanyService {
name, name,
city, city,
}, },
companyDomainNameColumnName,
transactionManager, transactionManager,
); );

View File

@ -17,6 +17,7 @@ export class ViewService {
fieldId, fieldId,
viewsIds, viewsIds,
positions, positions,
size,
}: { }: {
workspaceId: string; workspaceId: string;
fieldId: string; fieldId: string;
@ -24,6 +25,7 @@ export class ViewService {
positions?: { positions?: {
[key: string]: number; [key: string]: number;
}[]; }[];
size?: number;
}) { }) {
const viewFieldRepository = const viewFieldRepository =
await this.twentyORMGlobalManager.getRepositoryForWorkspace( await this.twentyORMGlobalManager.getRepositoryForWorkspace(
@ -51,6 +53,7 @@ export class ViewService {
fieldMetadataId: fieldId, fieldMetadataId: fieldId,
isVisible: true, isVisible: true,
...(isDefined(position) && { position: position }), ...(isDefined(position) && { position: position }),
...(isDefined(size) && { size: size }),
}); });
await viewFieldRepository.save(newViewField); await viewFieldRepository.save(newViewField);

View File

@ -0,0 +1,13 @@
import { isDefined } from 'class-validator';
// temporary, to remove once domainName has been fully migrated to Links type
export const getCompanyDomainName = (company: any) => {
if (!isDefined(company.domainName)) {
return company.domainName;
}
if (typeof company.domainName === 'string') {
return company.domainName;
} else {
return company.domainName.primaryLinkUrl;
}
};