Migrate domainName field from text type to links type (#6410)
Closes #5759.
This commit is contained in:
@ -61,6 +61,11 @@ linkedinLink
|
||||
secondaryLinks
|
||||
}
|
||||
domainName
|
||||
{
|
||||
primaryLinkUrl
|
||||
primaryLinkLabel
|
||||
secondaryLinks
|
||||
}
|
||||
annualRecurringRevenue
|
||||
{
|
||||
amountMicros
|
||||
@ -95,7 +100,11 @@ idealCustomerProfile
|
||||
people: true,
|
||||
xLink: true,
|
||||
linkedinLink: true,
|
||||
domainName: true,
|
||||
domainName: {
|
||||
primaryLinkUrl: true,
|
||||
primaryLinkLabel: true,
|
||||
secondaryLinks: true,
|
||||
},
|
||||
annualRecurringRevenue: true,
|
||||
createdAt: true,
|
||||
address: { addressStreet1: true },
|
||||
@ -136,6 +145,11 @@ linkedinLink
|
||||
secondaryLinks
|
||||
}
|
||||
domainName
|
||||
{
|
||||
primaryLinkUrl
|
||||
primaryLinkLabel
|
||||
secondaryLinks
|
||||
}
|
||||
annualRecurringRevenue
|
||||
{
|
||||
amountMicros
|
||||
|
||||
@ -61,6 +61,11 @@ linkedinLink
|
||||
secondaryLinks
|
||||
}
|
||||
domainName
|
||||
{
|
||||
primaryLinkUrl
|
||||
primaryLinkLabel
|
||||
secondaryLinks
|
||||
}
|
||||
annualRecurringRevenue
|
||||
{
|
||||
amountMicros
|
||||
|
||||
@ -5,6 +5,8 @@ import { getLogoUrlFromDomainName } from '~/utils';
|
||||
import { getImageAbsoluteURI } from '~/utils/image/getImageAbsoluteURI';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { Company } from '@/companies/types/Company';
|
||||
import { getCompanyDomainName } from '@/object-metadata/utils/getCompanyDomainName';
|
||||
import { getImageIdentifierFieldValue } from './getImageIdentifierFieldValue';
|
||||
|
||||
export const getAvatarUrl = (
|
||||
@ -17,7 +19,9 @@ export const getAvatarUrl = (
|
||||
}
|
||||
|
||||
if (objectNameSingular === CoreObjectNameSingular.Company) {
|
||||
return getLogoUrlFromDomainName(record.domainName ?? '');
|
||||
return getLogoUrlFromDomainName(
|
||||
getCompanyDomainName(record as Company) ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
if (objectNameSingular === CoreObjectNameSingular.Person) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
};
|
||||
@ -2940,7 +2940,7 @@ export const getObjectMetadataItemsMock = () => {
|
||||
{
|
||||
__typename: 'field',
|
||||
id: '20202020-5e4e-4007-a630-8a2617914889',
|
||||
type: 'TEXT',
|
||||
type: 'LINKS',
|
||||
name: 'domainName',
|
||||
label: 'Domain Name',
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user