File tree Expand file tree Collapse file tree
services/apps/snowflake_connectors/src
cvent/event-registrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,15 @@ export abstract class TransformerBase {
2929 */
3030 abstract transformRow ( row : Record < string , unknown > ) : TransformedActivity | null
3131
32+ private static readonly INDIVIDUAL_NO_ACCOUNT_RE = / ^ i n d i v i d u a l \s * (?: [ - – ? ] | w i t h ) \s * n o \s + a c c o u n t $ / i
33+
34+ protected isIndividualNoAccount ( displayName : string | null ) : boolean {
35+ if ( ! displayName ) {
36+ return false
37+ }
38+ return TransformerBase . INDIVIDUAL_NO_ACCOUNT_RE . test ( displayName . trim ( ) )
39+ }
40+
3241 /**
3342 * Safe wrapper around transformRow that catches errors and returns null.
3443 */
Original file line number Diff line number Diff line change @@ -154,9 +154,29 @@ export class CventTransformer extends TransformerBase {
154154 return undefined
155155 }
156156
157- const identities : IOrganizationIdentity [ ] = [ ]
158-
159157 const accountName = ( row . ACCOUNT_NAME as string | null ) ?. trim ( ) || null
158+ const displayName = accountName || website
159+
160+ if ( this . isIndividualNoAccount ( displayName ) ) {
161+ return [
162+ {
163+ displayName,
164+ source : OrganizationSource . CVENT ,
165+ identities : website
166+ ? [
167+ {
168+ platform : PlatformType . CVENT ,
169+ value : website ,
170+ type : OrganizationIdentityType . PRIMARY_DOMAIN ,
171+ verified : true ,
172+ } ,
173+ ]
174+ : [ ] ,
175+ } ,
176+ ]
177+ }
178+
179+ const identities : IOrganizationIdentity [ ] = [ ]
160180
161181 if ( website ) {
162182 identities . push ( {
@@ -183,7 +203,7 @@ export class CventTransformer extends TransformerBase {
183203
184204 return [
185205 {
186- displayName : accountName || website ,
206+ displayName,
187207 source : OrganizationSource . CVENT ,
188208 identities,
189209 logo : ( row . LOGO_URL as string | null ) ?. trim ( ) || undefined ,
Original file line number Diff line number Diff line change @@ -21,6 +21,27 @@ export abstract class TncTransformerBase extends TransformerBase {
2121 return undefined
2222 }
2323
24+ const displayName = ( row . ORGANIZATION_NAME as string | null ) ?. trim ( ) || website
25+
26+ if ( this . isIndividualNoAccount ( displayName ) ) {
27+ return [
28+ {
29+ displayName,
30+ source : OrganizationSource . TNC ,
31+ identities : website
32+ ? [
33+ {
34+ platform : PlatformType . TNC ,
35+ value : website ,
36+ type : OrganizationIdentityType . PRIMARY_DOMAIN ,
37+ verified : true ,
38+ } ,
39+ ]
40+ : [ ] ,
41+ } ,
42+ ]
43+ }
44+
2445 const identities : IOrganizationIdentity [ ] = [ ]
2546
2647 if ( website ) {
@@ -48,7 +69,7 @@ export abstract class TncTransformerBase extends TransformerBase {
4869
4970 return [
5071 {
51- displayName : ( row . ORGANIZATION_NAME as string | null ) ?. trim ( ) || website ,
72+ displayName,
5273 source : OrganizationSource . TNC ,
5374 identities,
5475 logo : ( row . LOGO_URL as string | null ) ?. trim ( ) || undefined ,
You can’t perform that action at this time.
0 commit comments