feat(medusa): Cart custom query strategy (#4083)

This commit is contained in:
Oliver Windall Juhl
2023-05-12 14:06:55 +02:00
committed by GitHub
parent 6511959e23
commit a666462333
6 changed files with 112 additions and 52 deletions
+8
View File
@@ -216,6 +216,7 @@
*/
import {
AfterLoad,
BeforeInsert,
Column,
Entity,
@@ -390,6 +391,13 @@ export class Cart extends SoftDeletableEntity {
gift_card_total?: number
gift_card_tax_total?: number
@AfterLoad()
private afterLoad(): void {
if (this.payment_sessions) {
this.payment_session = this.payment_sessions.find((p) => p.is_selected)!
}
}
@BeforeInsert()
private beforeInsert(): void {
this.id = generateEntityId(this.id, "cart")