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