Skip to content

Commit 23d0ee7

Browse files
committed
chore: use unified identity builder method
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
1 parent 8f7fe6d commit 23d0ee7

1 file changed

Lines changed: 7 additions & 45 deletions

File tree

  • services/apps/snowflake_connectors/src/integrations/cvent/event-registrations

services/apps/snowflake_connectors/src/integrations/cvent/event-registrations/transformer.ts

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import { CVENT_GRID, CventActivityType } from '@crowd/integrations'
22
import { getServiceChildLogger } from '@crowd/logging'
33
import {
44
IActivityData,
5-
IMemberData,
65
IOrganizationIdentity,
76
MemberAttributeName,
8-
MemberIdentityType,
97
OrganizationIdentityType,
108
OrganizationSource,
119
PlatformType,
@@ -34,55 +32,19 @@ export class CventTransformer extends TransformerBase {
3432
}
3533

3634
const registrationId = (row.REGISTRATION_ID as string)?.trim()
35+
const sourceId = (row.USER_ID as string | null) || undefined
3736

3837
const displayName =
3938
fullName ||
4039
(firstName && lastName ? `${firstName} ${lastName}` : firstName || lastName) ||
4140
userName
4241

43-
const identities: IMemberData['identities'] = []
44-
const sourceId = (row.USER_ID as string | null) || undefined
45-
46-
if (userName) {
47-
identities.push(
48-
{
49-
platform: PlatformType.CVENT,
50-
value: email,
51-
type: MemberIdentityType.EMAIL,
52-
verified: true,
53-
verifiedBy: PlatformType.CVENT,
54-
sourceId,
55-
},
56-
{
57-
platform: PlatformType.CVENT,
58-
value: userName,
59-
type: MemberIdentityType.USERNAME,
60-
verified: true,
61-
verifiedBy: PlatformType.CVENT,
62-
sourceId,
63-
},
64-
)
65-
} else {
66-
identities.push({
67-
platform: PlatformType.CVENT,
68-
value: email,
69-
type: MemberIdentityType.USERNAME,
70-
verified: true,
71-
verifiedBy: PlatformType.CVENT,
72-
sourceId,
73-
})
74-
}
75-
76-
if (lfUsername) {
77-
identities.push({
78-
platform: PlatformType.LFID,
79-
value: lfUsername,
80-
type: MemberIdentityType.USERNAME,
81-
verified: true,
82-
verifiedBy: PlatformType.CVENT,
83-
sourceId,
84-
})
85-
}
42+
const identities = this.buildMemberIdentities({
43+
email,
44+
sourceId,
45+
platformUsername: userName,
46+
lfUsername,
47+
})
8648

8749
const type =
8850
row.USER_ATTENDED === true

0 commit comments

Comments
 (0)