mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
fix: add space filter to "join" operation instead of "and" operation (#405)
This commit is contained in:
@ -105,18 +105,19 @@ export class CommunityService {
|
|||||||
*/
|
*/
|
||||||
pageable.where = {};
|
pageable.where = {};
|
||||||
let qb: undefined | SelectQueryBuilder<CommunityEntity> = undefined;
|
let qb: undefined | SelectQueryBuilder<CommunityEntity> = undefined;
|
||||||
|
|
||||||
|
qb = this.communityRepository
|
||||||
|
.createQueryBuilder('c')
|
||||||
|
.leftJoin('c.spaces', 's', 's.disabled = false')
|
||||||
|
.where('c.project = :projectUuid', { projectUuid })
|
||||||
|
.andWhere(`c.name != '${ORPHAN_COMMUNITY_NAME}-${project.name}'`)
|
||||||
|
.distinct(true);
|
||||||
if (pageable.search) {
|
if (pageable.search) {
|
||||||
qb = this.communityRepository
|
qb.andWhere(
|
||||||
.createQueryBuilder('c')
|
`c.name ILIKE '%${pageable.search}%' OR s.space_name ILIKE '%${pageable.search}%'`,
|
||||||
.leftJoin('c.spaces', 's')
|
);
|
||||||
.where('c.project = :projectUuid', { projectUuid })
|
|
||||||
.andWhere(`c.name != '${ORPHAN_COMMUNITY_NAME}-${project.name}'`)
|
|
||||||
.andWhere('s.disabled = false')
|
|
||||||
.andWhere(
|
|
||||||
`c.name ILIKE '%${pageable.search}%' OR s.space_name ILIKE '%${pageable.search}%'`,
|
|
||||||
)
|
|
||||||
.distinct(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const customModel = TypeORMCustomModel(this.communityRepository);
|
const customModel = TypeORMCustomModel(this.communityRepository);
|
||||||
|
|
||||||
const { baseResponseDto, paginationResponseDto } =
|
const { baseResponseDto, paginationResponseDto } =
|
||||||
|
Reference in New Issue
Block a user