mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-08-25 08:22:26 +00:00
remove space join if not required
This commit is contained in:
@ -187,12 +187,14 @@ export class CommunityService {
|
||||
const matchingCommunityIdsQb = this.communityRepository
|
||||
.createQueryBuilder('c')
|
||||
.select('c.uuid')
|
||||
.leftJoin('c.spaces', 'space')
|
||||
.where('c.project = :projectUuid', { projectUuid })
|
||||
.andWhere('c.name != :orphanCommunityName', {
|
||||
orphanCommunityName: `${ORPHAN_COMMUNITY_NAME}-${project.name}`,
|
||||
})
|
||||
.distinct(true);
|
||||
if (includeSpaces) {
|
||||
matchingCommunityIdsQb.leftJoin('c.spaces', 'space');
|
||||
}
|
||||
|
||||
if (search) {
|
||||
matchingCommunityIdsQb
|
||||
|
Reference in New Issue
Block a user