Compare commits

..

No commits in common. "f4387767a879821db5517c0c4e58dd5ff7267469" and "ee232447b695a3bbe965f3480efb5f2935383204" have entirely different histories.

5 changed files with 4 additions and 41 deletions

View File

@ -1,17 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddEstimationToItem1723801180604 implements MigrationInterface {
name = 'AddEstimationToItem1723801180604';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "items" ADD "play_estimation" integer`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "items" DROP COLUMN "play_estimation"`,
);
}
}

View File

@ -50,9 +50,6 @@ export class ItemModel
@Column('bigint', { name: 'base_price', nullable: true }) @Column('bigint', { name: 'base_price', nullable: true })
base_price: number; base_price: number;
@Column('int', { name: 'play_estimation', nullable: true })
play_estimation: number;
@Column('boolean', { name: 'use_queue', default: false }) @Column('boolean', { name: 'use_queue', default: false })
use_queue: boolean; use_queue: boolean;

View File

@ -48,7 +48,6 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
`${this.tableName}.use_queue`, `${this.tableName}.use_queue`,
`${this.tableName}.show_to_booking`, `${this.tableName}.show_to_booking`,
`${this.tableName}.breakdown_bundling`, `${this.tableName}.breakdown_bundling`,
`${this.tableName}.play_estimation`,
`item_category.id`, `item_category.id`,
`item_category.name`, `item_category.name`,

View File

@ -19,25 +19,14 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
} }
async afterProcess(): Promise<void> { async afterProcess(): Promise<void> {
this.result.data?.map((rates) => { this.result.data?.map((item) => {
const item = rates['item'];
const item_price = const item_price =
Number(item?.total_price ?? 0) == 0 Number(item['item']?.total_price ?? 0) == 0
? item?.total_price ? item['item']?.total_price
: item?.base_price; : item['item']?.base_price;
const bundlings = item?.bundling_items ?? [];
const bundling_items = bundlings.map((bundling) => {
const rate = bundling.item_rates?.[0]?.price ?? 0;
return {
...bundling,
item_rates: rate,
};
});
Object.assign(item, { Object.assign(item, {
price: item.price ?? item_price, price: item.price ?? item_price,
bundling_items,
}); });
}); });
return; return;
@ -54,7 +43,6 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
'season_period.season_type', 'season_period.season_type',
'item', 'item',
'item.bundling_items', 'item.bundling_items',
'bundling_items.item_rates',
], ],
// relation yang hanya ingin dihitung (akan return number) // relation yang hanya ingin dihitung (akan return number)
@ -76,9 +64,6 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
'bundling_items.hpp', 'bundling_items.hpp',
'bundling_items.id', 'bundling_items.id',
'bundling_items.name', 'bundling_items.name',
'item_rates.price',
`season_period.id`, `season_period.id`,
`season_period.priority`, `season_period.priority`,
`season_period.created_at`, `season_period.created_at`,

View File

@ -47,7 +47,6 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
`${this.tableName}.base_price`, `${this.tableName}.base_price`,
`${this.tableName}.share_profit`, `${this.tableName}.share_profit`,
`${this.tableName}.breakdown_bundling`, `${this.tableName}.breakdown_bundling`,
`${this.tableName}.play_estimation`,
`item_category.id`, `item_category.id`,
`item_category.name`, `item_category.name`,