feat: add query name filter to items
parent
55e89426d9
commit
8cfc003261
|
@ -23,6 +23,7 @@ export class BaseFilterDto implements BaseFilterEntity {
|
|||
@IsNumber()
|
||||
limit = 10;
|
||||
|
||||
@ApiProperty({ type: String, required: false })
|
||||
q: string;
|
||||
|
||||
@ApiProperty({ type: ['string'], required: false })
|
||||
|
|
|
@ -84,6 +84,12 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
|
|||
setQueryFilter(
|
||||
queryBuilder: SelectQueryBuilder<ItemEntity>,
|
||||
): SelectQueryBuilder<ItemEntity> {
|
||||
if (this.filterParam.q) {
|
||||
queryBuilder.andWhere(
|
||||
`${this.tableName}.name ILIKE '%${this.filterParam.q}%'`,
|
||||
);
|
||||
}
|
||||
|
||||
if (this.filterParam.tenant_ids?.length) {
|
||||
queryBuilder.andWhere(`${this.tableName}.tenant_id In (:...tenantIds)`, {
|
||||
tenantIds: this.filterParam.tenant_ids,
|
||||
|
|
Loading…
Reference in New Issue