chore: add cart links to promotions/product (#7428)

This commit is contained in:
Riqwan Thamir
2024-05-23 16:54:09 +02:00
committed by GitHub
parent e632b273b7
commit e3beaf5a29
7 changed files with 51 additions and 10 deletions

View File

@@ -29,26 +29,21 @@ export const CartPromotion: ModuleJoinerConfig = {
serviceName: Modules.PROMOTION,
primaryKey: "id",
foreignKey: "promotion_id",
alias: "promotion",
alias: "promotions",
},
],
extends: [
{
serviceName: Modules.CART,
fieldAlias: {
promotions: "cart_link.promotions",
},
relationship: {
serviceName: LINKS.CartPromotion,
primaryKey: "cart_id",
foreignKey: "id",
alias: "cart_link",
},
},
{
serviceName: Modules.PROMOTION,
relationship: {
serviceName: LINKS.CartPromotion,
primaryKey: "promotion_id",
foreignKey: "id",
alias: "promotion_link",
isList: true,
},
},
],

View File

@@ -3,6 +3,7 @@ export * from "./cart-product"
export * from "./cart-region"
export * from "./cart-sales-channel"
export * from "./inventory-level-stock-location"
export * from "./line-item-adjustment-promotion"
export * from "./order-customer"
export * from "./order-product"
export * from "./order-sales-channel"

View File

@@ -0,0 +1,18 @@
import { Modules } from "@medusajs/modules-sdk"
import { ModuleJoinerConfig } from "@medusajs/types"
export const LineItemAdjustmentPromotion: ModuleJoinerConfig = {
isLink: true,
isReadOnlyLink: true,
extends: [
{
serviceName: Modules.CART,
relationship: {
serviceName: Modules.PROMOTION,
primaryKey: "id",
foreignKey: "promotion_id",
alias: "promotion",
},
},
],
}