feat: add breakdown bundling to item transaction
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
parent
eaf0f43a24
commit
84b829a7fa
|
@ -0,0 +1,19 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddBreakdownToTransactionItem1724233193743
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddBreakdownToTransactionItem1724233193743';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_items" ADD "breakdown_bundling" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_items" DROP COLUMN "breakdown_bundling"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -90,6 +90,9 @@ export class TransactionItemModel
|
|||
})
|
||||
refunds: RefundItemModel[];
|
||||
|
||||
@Column('boolean', { name: 'breakdown_bundling', default: false })
|
||||
breakdown_bundling: boolean;
|
||||
|
||||
@OneToMany(
|
||||
() => TransactionItemBreakdownModel,
|
||||
(model) => model.transaction_item,
|
||||
|
|
|
@ -55,6 +55,7 @@ export function mappingTransaction(data, refundId?: string) {
|
|||
id: itemData.item_category_id,
|
||||
name: itemData.item_category_name,
|
||||
},
|
||||
breakdown_bundling: itemData.breakdown_bundling,
|
||||
bundling_items: itemData.bundling_items,
|
||||
},
|
||||
id: itemData.id,
|
||||
|
@ -189,6 +190,7 @@ export function mappingRevertTransaction(data, type) {
|
|||
item_bundlings: item.item.bundling_items?.map(
|
||||
(bundling) => bundling.name,
|
||||
),
|
||||
breakdown_bundling: item.item.breakdown_bundling,
|
||||
bundling_items: item.item.bundling_items?.map((bundling) => {
|
||||
if (bundling.item_id) return bundling;
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue