File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,38 +244,33 @@ export default class SegmentService extends LoggerBase {
244244 const qx = SequelizeRepository . getQueryExecutor ( { ...this . options , transaction } )
245245
246246 try {
247- const subproject = await this . createSubprojectInternal (
248- data ,
249- qx ,
247+ const subproject = await this . createSubprojectInternal ( data , qx , transaction )
248+
249+ const orgIds = await this . blockOrganizationAffiliationIfSegmentNameMatches (
250+ data . name ,
250251 transaction ,
251252 )
252-
253- const orgIds =
254- await this . blockOrganizationAffiliationIfSegmentNameMatches (
255- data . name ,
256- transaction ,
257- )
258-
253+
259254 await SequelizeRepository . commitTransaction ( transaction )
260-
255+
261256 if ( orgIds ?. length ) {
262257 const organizationService = new OrganizationService ( this . options )
263-
258+
264259 for ( const orgId of orgIds ) {
265260 await organizationService . startOrganizationUpdateWorkflow ( orgId , {
266261 syncToOpensearch : true ,
267262 recalculateAffiliations : true ,
268263 } )
269264 }
270265 }
271-
266+
272267 return await this . findById ( subproject . id )
273268 } catch ( error ) {
274269 await SequelizeRepository . rollbackTransaction ( transaction )
275270 throw error
276271 }
277272 }
278-
273+
279274 async createSubprojectInternal (
280275 data : SegmentData ,
281276 qx : QueryExecutor ,
You can’t perform that action at this time.
0 commit comments