fix(relasi) penambahan relasi tenant get
parent
766909798f
commit
84bf55011d
|
@ -23,7 +23,11 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
|
||||||
joinRelations: [],
|
joinRelations: [],
|
||||||
|
|
||||||
// relation join and select (relasi yang ingin ditampilkan),
|
// relation join and select (relasi yang ingin ditampilkan),
|
||||||
selectRelations: ['item_category', 'bundling_items'],
|
selectRelations: [
|
||||||
|
'item_category',
|
||||||
|
'bundling_items',
|
||||||
|
'tenant',
|
||||||
|
],
|
||||||
|
|
||||||
// relation yang hanya ingin dihitung (akan return number)
|
// relation yang hanya ingin dihitung (akan return number)
|
||||||
countRelations: [],
|
countRelations: [],
|
||||||
|
@ -32,19 +36,19 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
|
||||||
|
|
||||||
get selects(): string[] {
|
get selects(): string[] {
|
||||||
return [
|
return [
|
||||||
`${this.tableName}.id`,
|
`${ this.tableName }.id`,
|
||||||
`${this.tableName}.created_at`,
|
`${ this.tableName }.created_at`,
|
||||||
`${this.tableName}.status`,
|
`${ this.tableName }.status`,
|
||||||
`${this.tableName}.item_type`,
|
`${ this.tableName }.item_type`,
|
||||||
`${this.tableName}.name`,
|
`${ this.tableName }.name`,
|
||||||
`${this.tableName}.limit_type`,
|
`${ this.tableName }.limit_type`,
|
||||||
`${this.tableName}.limit_value`,
|
`${ this.tableName }.limit_value`,
|
||||||
`${this.tableName}.hpp`,
|
`${ this.tableName }.hpp`,
|
||||||
`${this.tableName}.sales_margin`,
|
`${ this.tableName }.sales_margin`,
|
||||||
`${this.tableName}.total_price`,
|
`${ this.tableName }.total_price`,
|
||||||
`${this.tableName}.base_price`,
|
`${ this.tableName }.base_price`,
|
||||||
`${this.tableName}.use_queue`,
|
`${ this.tableName }.use_queue`,
|
||||||
`${this.tableName}.show_to_booking`,
|
`${ this.tableName }.show_to_booking`,
|
||||||
|
|
||||||
`item_category.id`,
|
`item_category.id`,
|
||||||
`item_category.name`,
|
`item_category.name`,
|
||||||
|
@ -53,6 +57,9 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
|
||||||
'bundling_items.name',
|
'bundling_items.name',
|
||||||
'bundling_items.hpp',
|
'bundling_items.hpp',
|
||||||
'bundling_items.base_price',
|
'bundling_items.base_price',
|
||||||
|
|
||||||
|
'tenant.id',
|
||||||
|
'tenant.name'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,11 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
|
||||||
joinRelations: [],
|
joinRelations: [],
|
||||||
|
|
||||||
// relation join and select (relasi yang ingin ditampilkan),
|
// relation join and select (relasi yang ingin ditampilkan),
|
||||||
selectRelations: ['item_category', 'bundling_items'],
|
selectRelations: [
|
||||||
|
'item_category',
|
||||||
|
'bundling_items',
|
||||||
|
'tenant',
|
||||||
|
],
|
||||||
|
|
||||||
// relation yang hanya ingin dihitung (akan return number)
|
// relation yang hanya ingin dihitung (akan return number)
|
||||||
countRelations: [],
|
countRelations: [],
|
||||||
|
@ -36,36 +40,39 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
|
||||||
|
|
||||||
get selects(): string[] {
|
get selects(): string[] {
|
||||||
return [
|
return [
|
||||||
`${this.tableName}.id`,
|
`${ this.tableName }.id`,
|
||||||
`${this.tableName}.created_at`,
|
`${ this.tableName }.created_at`,
|
||||||
`${this.tableName}.status`,
|
`${ this.tableName }.status`,
|
||||||
`${this.tableName}.item_type`,
|
`${ this.tableName }.item_type`,
|
||||||
`${this.tableName}.name`,
|
`${ this.tableName }.name`,
|
||||||
`${this.tableName}.hpp`,
|
`${ this.tableName }.hpp`,
|
||||||
`${this.tableName}.limit_type`,
|
`${ this.tableName }.limit_type`,
|
||||||
`${this.tableName}.limit_value`,
|
`${ this.tableName }.limit_value`,
|
||||||
`${this.tableName}.base_price`,
|
`${ this.tableName }.base_price`,
|
||||||
|
|
||||||
`item_category.id`,
|
`item_category.id`,
|
||||||
`item_category.name`,
|
`item_category.name`,
|
||||||
|
|
||||||
'bundling_items.id',
|
'bundling_items.id',
|
||||||
'bundling_items.name',
|
'bundling_items.name',
|
||||||
|
|
||||||
|
'tenant.id',
|
||||||
|
'tenant.name'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
get specificFilter(): Param[] {
|
get specificFilter(): Param[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
cols: `${this.tableName}.name`,
|
cols: `${ this.tableName }.name`,
|
||||||
data: this.filterParam.names,
|
data: this.filterParam.names,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
cols: `${this.tableName}.item_type::text`,
|
cols: `${ this.tableName }.item_type::text`,
|
||||||
data: this.filterParam.item_types,
|
data: this.filterParam.item_types,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
cols: `${this.tableName}.limit_type::text`,
|
cols: `${ this.tableName }.limit_type::text`,
|
||||||
data: this.filterParam.limit_types,
|
data: this.filterParam.limit_types,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -79,11 +86,11 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
|
||||||
queryBuilder: SelectQueryBuilder<ItemEntity>,
|
queryBuilder: SelectQueryBuilder<ItemEntity>,
|
||||||
): SelectQueryBuilder<ItemEntity> {
|
): SelectQueryBuilder<ItemEntity> {
|
||||||
if (this.filterParam.tenant_ids?.length) {
|
if (this.filterParam.tenant_ids?.length) {
|
||||||
queryBuilder.andWhere(`${this.tableName}.tenant_id In (:...tenantIds)`, {
|
queryBuilder.andWhere(`${ this.tableName }.tenant_id In (:...tenantIds)`, {
|
||||||
tenantIds: this.filterParam.tenant_ids,
|
tenantIds: this.filterParam.tenant_ids,
|
||||||
});
|
});
|
||||||
} else if (!this.filterParam.all_item) {
|
} else if (!this.filterParam.all_item) {
|
||||||
queryBuilder.andWhere(`${this.tableName}.tenant_id Is Null`);
|
queryBuilder.andWhere(`${ this.tableName }.tenant_id Is Null`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryBuilder;
|
return queryBuilder;
|
||||||
|
|
Loading…
Reference in New Issue