Migrate domainName field from text type to links type (#6410)
Closes #5759.
This commit is contained in:
13
packages/twenty-server/src/utils/getCompanyDomainName.ts
Normal file
13
packages/twenty-server/src/utils/getCompanyDomainName.ts
Normal 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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user