Skip to content

Commit cc4d33b

Browse files
authored
fix: deleting member fails when removing segments (CM-1312) (#4303)
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 2bf124b commit cc4d33b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

backend/src/database/repositories/memberRepository.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ class MemberRepository {
244244

245245
const subprojectIds = await getSegmentSubprojectIds(qx, currentSegments)
246246

247+
if (subprojectIds.length === 0) {
248+
return
249+
}
250+
247251
await seq.query(bulkDeleteMemberSegments, {
248252
replacements: {
249253
memberIds,

backend/src/database/repositories/organizationRepository.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ class OrganizationRepository {
192192
const qx = SequelizeRepository.getQueryExecutor(options)
193193
const subprojectIds = await getSegmentSubprojectIds(qx, currentSegments)
194194

195+
if (subprojectIds.length === 0) {
196+
return
197+
}
198+
195199
await seq.query(bulkDeleteOrganizationSegments, {
196200
replacements: {
197201
organizationIds,

0 commit comments

Comments
 (0)