fix(SPG-559) Item rate - index - search masih belum bisa (masih menampilkan semua data)

pull/5/head
Aswin Ashar Abdullah 2024-06-25 13:49:46 +07:00
parent c35f966b5a
commit bc296cc52a
1 changed files with 25 additions and 1 deletions

View File

@ -90,12 +90,36 @@ export class IndexItemRateManager extends BaseIndexManager<ItemEntity> {
}
get specificFilter(): Param[] {
return [];
return [
{
cols: `${ this.tableName }.name`,
data: this.filterParam.names,
},
{
cols: `${ this.tableName }.item_type::text`,
data: this.filterParam.item_types,
},
{
cols: `${ this.tableName }.limit_type::text`,
data: this.filterParam.limit_types,
},
{
cols: `item_category.name`,
data: this.filterParam.item_categories,
},
];
}
setQueryFilter(
queryBuilder: SelectQueryBuilder<ItemEntity>,
): SelectQueryBuilder<ItemEntity> {
if (this.filterParam.tenant_ids?.length) {
queryBuilder.andWhere(`${ this.tableName }.tenant_id In (:...tenantIds)`, {
tenantIds: this.filterParam.tenant_ids,
});
} else if (!this.filterParam.all_item) {
queryBuilder.andWhere(`${ this.tableName }.tenant_id Is Null`);
}
return queryBuilder;
}