pos-be/src/modules/item-related/item/domain/usecases/managers/detail-item.manager.ts

72 lines
1.9 KiB
TypeScript

import { Injectable } from '@nestjs/common';
import { BaseDetailManager } from 'src/core/modules/domain/usecase/managers/base-detail.manager';
import { ItemEntity } from '../../entities/item.entity';
import { RelationParam } from 'src/core/modules/domain/entities/base-filter.entity';
@Injectable()
export class DetailItemManager extends BaseDetailManager<ItemEntity> {
async prepareData(): Promise<void> {
return;
}
async beforeProcess(): Promise<void> {
return;
}
async afterProcess(): Promise<void> {
return;
}
get relations(): RelationParam {
return {
// relation only join (for query purpose)
joinRelations: [],
// relation join and select (relasi yang ingin ditampilkan),
selectRelations: ['item_category', 'bundling_items', 'tenant'],
// relation yang hanya ingin dihitung (akan return number)
countRelations: [],
};
}
get selects(): string[] {
return [
`${this.tableName}.id`,
`${this.tableName}.image_url`,
`${this.tableName}.created_at`,
`${this.tableName}.status`,
`${this.tableName}.item_type`,
`${this.tableName}.name`,
`${this.tableName}.limit_type`,
`${this.tableName}.limit_value`,
`${this.tableName}.hpp`,
`${this.tableName}.sales_margin`,
`${this.tableName}.share_profit`,
`${this.tableName}.total_price`,
`${this.tableName}.base_price`,
`${this.tableName}.use_queue`,
`${this.tableName}.show_to_booking`,
`${this.tableName}.breakdown_bundling`,
`${this.tableName}.play_estimation`,
`item_category.id`,
`item_category.name`,
'bundling_items.id',
'bundling_items.name',
'bundling_items.hpp',
'bundling_items.base_price',
'tenant.id',
'tenant.name',
];
}
get setFindProperties(): any {
return {
id: this.dataId,
};
}
}