File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
services/apps/data_sink_worker/src/service Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -329,8 +329,14 @@ export default class OrganizationService extends LoggerBase {
329329 }
330330
331331 let record
332+ let existing
332333
333- const existing = await OrganizationRepository . findByIdentity ( primaryIdentity , this . options )
334+ // check if organization already exists using website or primary identity
335+ if ( data . website ) {
336+ existing = await OrganizationRepository . findByDomain ( data . website , this . options )
337+ } else {
338+ existing = await OrganizationRepository . findByIdentity ( primaryIdentity , this . options )
339+ }
334340
335341 if ( existing ) {
336342 await OrganizationRepository . checkIdentities ( data , this . options , existing . id )
Original file line number Diff line number Diff line change @@ -115,8 +115,14 @@ export class OrganizationService extends LoggerBase {
115115 }
116116 }
117117
118- // now check if exists in this tenant using the primary identity
119- const existing = await txRepo . findByIdentity ( tenantId , primaryIdentity )
118+ let existing
119+
120+ // now check if exists in this tenant using the website or primary identity
121+ if ( data . website ) {
122+ existing = await txRepo . findByDomain ( tenantId , segmentId , data . website )
123+ } else {
124+ existing = await txRepo . findByIdentity ( tenantId , primaryIdentity )
125+ }
120126
121127 let attributes = existing ?. attributes
122128
You can’t perform that action at this time.
0 commit comments