Skip to content

Commit

Permalink
fix cart
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl committed Feb 23, 2024
1 parent 7a00c90 commit 68ceb77
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
14 changes: 10 additions & 4 deletions packages/cart/src/models/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ export default class Cart {
mapToPk: true,
nullable: true,
})
shipping_address_id?: string | null
shipping_address_id: string | null

@ManyToOne(() => Address, { persist: false })
@ManyToOne(() => Address, {
cascade: [Cascade.PERSIST],
nullable: true,
})
shipping_address: Address | null

@BillingAddressIdIndex()
Expand All @@ -122,9 +125,12 @@ export default class Cart {
mapToPk: true,
nullable: true,
})
billing_address_id?: string | null
billing_address_id: string | null

@ManyToOne(() => Address, { persist: false })
@ManyToOne(() => Address, {
cascade: [Cascade.PERSIST],
nullable: true,
})
billing_address: Address | null

@Property({ columnType: "jsonb", nullable: true })
Expand Down
18 changes: 9 additions & 9 deletions packages/cart/src/services/cart-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export default class CartModuleService<
? methodIdsOrSelector
: [methodIdsOrSelector]
}
await this.shippingMethodService_.delete(toDelete, sharedContext)
await this.shippingMethodService_.softDelete(toDelete, sharedContext)
}

async addLineItemAdjustments(
Expand Down Expand Up @@ -736,7 +736,7 @@ export default class CartModuleService<
})

if (toDelete.length) {
await this.lineItemAdjustmentService_.delete(
await this.lineItemAdjustmentService_.softDelete(
toDelete.map((adj) => adj!.id),
sharedContext
)
Expand Down Expand Up @@ -791,7 +791,7 @@ export default class CartModuleService<
: [adjustmentIdsOrSelector]
}

await this.lineItemAdjustmentService_.delete(ids, sharedContext)
await this.lineItemAdjustmentService_.softDelete(ids, sharedContext)
}

@InjectTransactionManager("baseRepository_")
Expand Down Expand Up @@ -833,7 +833,7 @@ export default class CartModuleService<
)

if (toDelete.length) {
await this.shippingMethodAdjustmentService_.delete(
await this.shippingMethodAdjustmentService_.softDelete(
toDelete.map((adj) => adj!.id),
sharedContext
)
Expand Down Expand Up @@ -960,7 +960,7 @@ export default class CartModuleService<
: [adjustmentIdsOrSelector]
}

await this.shippingMethodAdjustmentService_.delete(ids, sharedContext)
await this.shippingMethodAdjustmentService_.softDelete(ids, sharedContext)
}

addLineItemTaxLines(
Expand Down Expand Up @@ -1058,7 +1058,7 @@ export default class CartModuleService<
})

if (toDelete.length) {
await this.lineItemTaxLineService_.delete(
await this.lineItemTaxLineService_.softDelete(
toDelete.map((taxLine) => taxLine!.id),
sharedContext
)
Expand Down Expand Up @@ -1114,7 +1114,7 @@ export default class CartModuleService<
: [taxLineIdsOrSelector]
}

await this.lineItemTaxLineService_.delete(ids, sharedContext)
await this.lineItemTaxLineService_.softDelete(ids, sharedContext)
}

addShippingMethodTaxLines(
Expand Down Expand Up @@ -1216,7 +1216,7 @@ export default class CartModuleService<
})

if (toDelete.length) {
await this.shippingMethodTaxLineService_.delete(
await this.shippingMethodTaxLineService_.softDelete(
toDelete.map((taxLine) => taxLine!.id),
sharedContext
)
Expand Down Expand Up @@ -1271,6 +1271,6 @@ export default class CartModuleService<
: [taxLineIdsOrSelector]
}

await this.shippingMethodTaxLineService_.delete(ids, sharedContext)
await this.shippingMethodTaxLineService_.softDelete(ids, sharedContext)
}
}

0 comments on commit 68ceb77

Please sign in to comment.