Skip to content

Commit 2366cf4

Browse files
committed
Merge branch 'main' into better-error-message-handling-CM-1117
2 parents 82a4065 + 35b0b24 commit 2366cf4

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

backend/src/database/repositories/memberRepository.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,17 @@ class MemberRepository {
291291
await new SegmentRepository(options).getSegmentSubprojects(currentSegments)
292292
).map((s) => s.id)
293293

294+
if (segmentIds.length === 0) {
295+
return args.countOnly
296+
? { count: '0' }
297+
: {
298+
rows: [{ members: [], similarity: 0 }],
299+
count: 0,
300+
limit: args.limit,
301+
offset: args.offset,
302+
}
303+
}
304+
294305
let similarityFilter = ''
295306
const similarityConditions = []
296307

backend/src/database/repositories/segmentRepository.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ class SegmentRepository extends RepositoryBase<
296296
}
297297

298298
async getSegmentSubprojects(segments: string[]) {
299+
if (segments.length === 0) return []
300+
299301
const transaction = this.transaction
300302

301303
const records = await this.options.database.sequelize.query(

0 commit comments

Comments
 (0)