chore: complete cart part 2 (#7227)

This commit is contained in:
Carlos R. L. Rodrigues
2024-05-05 10:35:09 -03:00
committed by GitHub
parent c32a31e139
commit aba194de9a
24 changed files with 344 additions and 321 deletions

View File

@@ -1,11 +1,6 @@
export * from "./cart-customer"
export * from "./cart-payment-collection"
export * from "./cart-promotion"
export * from "./cart-region"
export * from "./cart-sales-channel"
export * from "./inventory-level-stock-location"
export * from "./location-fulfillment-set"
export * from "./order-customer"
export * from "./fulfillment-set-location"
export * from "./order-promotion"
export * from "./order-region"
export * from "./order-sales-channel"
@@ -14,8 +9,7 @@ export * from "./product-shipping-profile"
export * from "./product-variant-inventory-item"
export * from "./product-variant-price-set"
export * from "./publishable-api-key-sales-channel"
export * from "./readonly"
export * from "./region-payment-provider"
export * from "./sales-channel-location"
export * from "./shipping-option-price-set"
export * from "./store-default-currency"

View File

@@ -0,0 +1,43 @@
import { Modules } from "@medusajs/modules-sdk"
import { ModuleJoinerConfig } from "@medusajs/types"
export const CartProduct: ModuleJoinerConfig = {
isLink: true,
isReadOnlyLink: true,
extends: [
{
serviceName: Modules.CART,
relationship: {
serviceName: Modules.PRODUCT,
primaryKey: "id",
foreignKey: "items.product_id",
alias: "product",
},
},
{
serviceName: Modules.CART,
relationship: {
serviceName: Modules.PRODUCT,
primaryKey: "id",
foreignKey: "items.variant_id",
alias: "variant",
args: {
methodSuffix: "Variants",
},
},
},
{
serviceName: Modules.PRODUCT,
relationship: {
serviceName: Modules.CART,
primaryKey: "variant_id",
foreignKey: "id",
alias: "cart_items",
isList: true,
args: {
methodSuffix: "LineItems",
},
},
},
],
}

View File

@@ -0,0 +1,7 @@
export * from "./cart-customer"
export * from "./cart-product"
export * from "./cart-region"
export * from "./cart-sales-channel"
export * from "./inventory-level-stock-location"
export * from "./order-customer"
export * from "./store-default-currency"