Skip to content

Commit 623f738

Browse files
committed
fix: activity mapping and add attributes
1 parent 732f8bd commit 623f738

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

  • services/apps/snowflake_connectors/src/integrations/cvent

services/apps/snowflake_connectors/src/integrations/cvent/transformer.ts

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
IActivityData,
44
IMemberData,
55
IOrganizationIdentity,
6+
MemberAttributeName,
67
MemberIdentityType,
78
OrganizationIdentityType,
89
OrganizationSource,
@@ -15,12 +16,16 @@ export class CventTransformer extends TransformerBase {
1516
readonly platform = PlatformType.CVENT
1617

1718
transformRow(row: Record<string, unknown>): TransformedActivity | null {
18-
const userName = (row.USERNAME as string | null)?.trim() || null
19+
const userName = (row.USER_NAME as string | null)?.trim() || null
1920
const lfUsername = (row.LFID as string | null)?.trim() || null
2021
const fullName = (row.FULL_NAME as string | null)?.trim() || null
2122
const firstName = (row.FIRST_NAME as string | null)?.trim() || null
2223
const lastName = (row.LAST_NAME as string | null)?.trim() || null
23-
const email = (row.EMAIL as string)?.trim()
24+
const email = (row.EMAIL as string | null)?.trim() || null
25+
if (!email) {
26+
return null
27+
}
28+
2429
const registrationId = (row.REGISTRATION_ID as string)?.trim()
2530

2631
const displayName =
@@ -86,6 +91,23 @@ export class CventTransformer extends TransformerBase {
8691
displayName,
8792
identities,
8893
organizations: this.buildOrganizations(row),
94+
attributes: {
95+
...((row.JOB_TITLE as string | null) && {
96+
[MemberAttributeName.JOB_TITLE]: {
97+
[PlatformType.CVENT]: row.JOB_TITLE as string,
98+
},
99+
}),
100+
...((row.USER_PHOTO_URL as string | null) && {
101+
[MemberAttributeName.AVATAR_URL]: {
102+
[PlatformType.CVENT]: row.USER_PHOTO_URL as string,
103+
},
104+
}),
105+
...((row.USER_COUNTRY as string | null) && {
106+
[MemberAttributeName.COUNTRY]: {
107+
[PlatformType.CVENT]: row.USER_COUNTRY as string,
108+
},
109+
}),
110+
}
89111
},
90112
attributes: {
91113
eventName: row.EVENT_NAME as string,
@@ -124,14 +146,6 @@ export class CventTransformer extends TransformerBase {
124146
const identities: IOrganizationIdentity[] = []
125147

126148
const accountName = (row.ACCOUNT_NAME as string | null)?.trim() || null
127-
if (accountName) {
128-
identities.push({
129-
platform: PlatformType.CVENT,
130-
value: accountName,
131-
type: OrganizationIdentityType.USERNAME,
132-
verified: false,
133-
})
134-
}
135149

136150
if (website) {
137151
identities.push({
@@ -161,6 +175,9 @@ export class CventTransformer extends TransformerBase {
161175
displayName: accountName || website,
162176
source: OrganizationSource.CVENT,
163177
identities,
178+
logo: (row.LOGO_URL as string | null)?.trim() || undefined,
179+
size: (row.ORGANIZATION_SIZE as string | null)?.trim() || undefined,
180+
industry: (row.ORGANIZATION_INDUSTRY as string | null)?.trim() || undefined,
164181
},
165182
]
166183
}

0 commit comments

Comments
 (0)