Skip to content

Commit 30c1f96

Browse files
authored
Set displayName for orgs from work experiences and enrichment (#1666)
1 parent fa42a40 commit 30c1f96

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

backend/src/services/organizationService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,11 @@ export default class OrganizationService extends LoggerBase {
446446
if (existing) {
447447
await OrganizationRepository.checkIdentities(data, this.options, existing.id)
448448

449+
// Set displayName if it doesn't exist
450+
if (!existing.displayName) {
451+
data.displayName = cache.name
452+
}
453+
449454
record = await OrganizationRepository.update(
450455
existing.id,
451456
{ ...data, ...cache },

backend/src/services/premium/enrichment/organizationEnrichmentService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ export default class OrganizationEnrichmentService extends LoggerBase {
373373
}
374374
}
375375

376+
// Set displayName using the first identity or fallback to website
377+
if (!data.displayName) {
378+
const identity = data.identities[0]
379+
data.displayName = identity ? identity.name : data.website
380+
}
381+
376382
return lodash.pick(
377383
{ ...data, lastEnrichedAt: new Date() },
378384
this.selectFieldsForEnrichment(instance),

services/libs/types/src/organizations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { OrganizationSource } from './enums/organizations'
33

44
export interface IOrganization {
55
id?: string
6+
displayName?: string
67
url?: string
78
description?: string
89
emails?: string[]

0 commit comments

Comments
 (0)