mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
Compare commits
1 Commits
5cf45c30f4
...
fix/get-co
Author | SHA1 | Date | |
---|---|---|---|
4aacbd8000 |
@ -190,25 +190,26 @@ export class CommunityService {
|
|||||||
.distinct(true);
|
.distinct(true);
|
||||||
|
|
||||||
if (includeSpaces) {
|
if (includeSpaces) {
|
||||||
qb.leftJoinAndSelect('c.spaces', 'space', 'space.disabled = false')
|
qb.leftJoinAndSelect(
|
||||||
|
'c.spaces',
|
||||||
|
'space',
|
||||||
|
'space.disabled = :disabled AND space.spaceName != :orphanSpaceName',
|
||||||
|
{ disabled: false, orphanSpaceName: ORPHAN_SPACE_NAME },
|
||||||
|
)
|
||||||
.leftJoinAndSelect('space.parent', 'parent')
|
.leftJoinAndSelect('space.parent', 'parent')
|
||||||
.leftJoinAndSelect(
|
.leftJoinAndSelect(
|
||||||
'space.children',
|
'space.children',
|
||||||
'children',
|
'children',
|
||||||
'children.disabled = :disabled',
|
'children.disabled = :disabled',
|
||||||
{ disabled: false },
|
{ disabled: false },
|
||||||
)
|
);
|
||||||
// .leftJoinAndSelect('space.spaceModel', 'spaceModel')
|
// .leftJoinAndSelect('space.spaceModel', 'spaceModel')
|
||||||
.andWhere('space.spaceName != :orphanSpaceName', {
|
|
||||||
orphanSpaceName: ORPHAN_SPACE_NAME,
|
|
||||||
})
|
|
||||||
.andWhere('space.disabled = :disabled', { disabled: false });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
qb.andWhere(
|
qb.andWhere(
|
||||||
`c.name ILIKE :search ${includeSpaces ? 'OR space.space_name ILIKE :search' : ''}`,
|
`c.name ILIKE :search ${includeSpaces ? 'OR space.space_name ILIKE :search' : ''}`,
|
||||||
{ search: `%${search}%` },
|
{ search },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +217,6 @@ export class CommunityService {
|
|||||||
|
|
||||||
const { baseResponseDto, paginationResponseDto } =
|
const { baseResponseDto, paginationResponseDto } =
|
||||||
await customModel.findAll({ ...pageable, modelName: 'community' }, qb);
|
await customModel.findAll({ ...pageable, modelName: 'community' }, qb);
|
||||||
|
|
||||||
if (includeSpaces) {
|
if (includeSpaces) {
|
||||||
baseResponseDto.data = baseResponseDto.data.map((community) => ({
|
baseResponseDto.data = baseResponseDto.data.map((community) => ({
|
||||||
...community,
|
...community,
|
||||||
|
Reference in New Issue
Block a user