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 {
329
329
}
330
330
331
331
let record
332
+ let existing
332
333
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
+ }
334
340
335
341
if ( existing ) {
336
342
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 {
115
115
}
116
116
}
117
117
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
+ }
120
126
121
127
let attributes = existing ?. attributes
122
128
You can’t perform that action at this time.
0 commit comments