mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-08-26 06:29:38 +00:00
add where for community name
This commit is contained in:
@ -3,8 +3,8 @@ import { AddCommunityDto, GetCommunityParams, ProjectParam } from '../dtos';
|
||||
import { UpdateCommunityNameDto } from '../dtos/update.community.dto';
|
||||
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||
import {
|
||||
ExtendedTypeORMCustomModelFindAllQuery,
|
||||
TypeORMCustomModel,
|
||||
TypeORMCustomModelFindAllQuery,
|
||||
} from '@app/common/models/typeOrmCustom.model';
|
||||
import { PageResponse } from '@app/common/dto/pagination.response.dto';
|
||||
import { CommunityRepository } from '@app/common/modules/community/repositories';
|
||||
@ -13,7 +13,7 @@ import { SuccessResponseDto } from '@app/common/dto/success.response.dto';
|
||||
import { TuyaService } from '@app/common/integrations/tuya/services/tuya.service';
|
||||
import { ProjectRepository } from '@app/common/modules/project/repositiories';
|
||||
import { ORPHAN_COMMUNITY_NAME } from '@app/common/constants/orphan-constant';
|
||||
import { Not } from 'typeorm';
|
||||
import { ILike, Not } from 'typeorm';
|
||||
import { SpaceService } from 'src/space/services';
|
||||
|
||||
@Injectable()
|
||||
@ -84,7 +84,7 @@ export class CommunityService {
|
||||
|
||||
async getCommunities(
|
||||
param: ProjectParam,
|
||||
pageable: Partial<TypeORMCustomModelFindAllQuery>,
|
||||
pageable: Partial<ExtendedTypeORMCustomModelFindAllQuery>,
|
||||
): Promise<BaseResponseDto> {
|
||||
try {
|
||||
const project = await this.validateProject(param.projectUuid);
|
||||
@ -95,6 +95,9 @@ export class CommunityService {
|
||||
name: Not(`${ORPHAN_COMMUNITY_NAME}-${project.name}`),
|
||||
};
|
||||
|
||||
if (pageable.search) {
|
||||
pageable.where = { name: ILike(`%${pageable.search}%`) };
|
||||
}
|
||||
const customModel = TypeORMCustomModel(this.communityRepository);
|
||||
|
||||
const { baseResponseDto, paginationResponseDto } =
|
||||
|
Reference in New Issue
Block a user