chore: add cart links to promotions/product (#7428)
This commit is contained in:
1 parent
e632b273b7
commit
e3beaf5a29
7 files changed
+51
-10
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
import { ApplicationMethodTypeValues } from "../../promotion"
|
||||||
|
|
||||||
|
export interface BasePromotion {
|
||||||
|
id: string
|
||||||
|
code?: string
|
||||||
|
is_automatic?: boolean
|
||||||
|
application_method?: {
|
||||||
|
type?: ApplicationMethodTypeValues
|
||||||
|
value?: number
|
||||||
|
currency_code?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
export * from "./admin"
|
export * from "./admin"
|
||||||
|
export * from "./store"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { BasePromotion } from "./common"
|
||||||
|
|
||||||
|
export interface StorePromotion extends BasePromotion {}
|
||||||
@@ -23,9 +23,19 @@ export const defaultStoreCartFields = [
|
|||||||
"original_shipping_tax_total",
|
"original_shipping_tax_total",
|
||||||
"original_shipping_tax_subtotal",
|
"original_shipping_tax_subtotal",
|
||||||
"original_shipping_total",
|
"original_shipping_total",
|
||||||
|
"promotions.id",
|
||||||
|
"promotions.code",
|
||||||
|
"promotions.is_automatic",
|
||||||
|
"promotions.application_method.value",
|
||||||
|
"promotions.application_method.type",
|
||||||
|
"promotions.application_method.currency_code",
|
||||||
"items.id",
|
"items.id",
|
||||||
"items.variant_id",
|
"items.variant_id",
|
||||||
"items.product_id",
|
"items.product_id",
|
||||||
|
"items.product.categories.id",
|
||||||
|
"items.product.tags.id",
|
||||||
|
"items.product.collection_id",
|
||||||
|
"items.product.type_id",
|
||||||
"items.product_title",
|
"items.product_title",
|
||||||
"items.product_description",
|
"items.product_description",
|
||||||
"items.product_subtitle",
|
"items.product_subtitle",
|
||||||
@@ -47,6 +57,7 @@ export const defaultStoreCartFields = [
|
|||||||
"items.tax_lines.provider_id",
|
"items.tax_lines.provider_id",
|
||||||
"items.adjustments.id",
|
"items.adjustments.id",
|
||||||
"items.adjustments.code",
|
"items.adjustments.code",
|
||||||
|
"items.adjustments.promotion_id",
|
||||||
"items.adjustments.amount",
|
"items.adjustments.amount",
|
||||||
"customer.id",
|
"customer.id",
|
||||||
"customer.email",
|
"customer.email",
|
||||||
|
|||||||
@@ -29,26 +29,21 @@ export const CartPromotion: ModuleJoinerConfig = {
|
|||||||
serviceName: Modules.PROMOTION,
|
serviceName: Modules.PROMOTION,
|
||||||
primaryKey: "id",
|
primaryKey: "id",
|
||||||
foreignKey: "promotion_id",
|
foreignKey: "promotion_id",
|
||||||
alias: "promotion",
|
alias: "promotions",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
extends: [
|
extends: [
|
||||||
{
|
{
|
||||||
serviceName: Modules.CART,
|
serviceName: Modules.CART,
|
||||||
|
fieldAlias: {
|
||||||
|
promotions: "cart_link.promotions",
|
||||||
|
},
|
||||||
relationship: {
|
relationship: {
|
||||||
serviceName: LINKS.CartPromotion,
|
serviceName: LINKS.CartPromotion,
|
||||||
primaryKey: "cart_id",
|
primaryKey: "cart_id",
|
||||||
foreignKey: "id",
|
foreignKey: "id",
|
||||||
alias: "cart_link",
|
alias: "cart_link",
|
||||||
},
|
isList: true,
|
||||||
},
|
|
||||||
{
|
|
||||||
serviceName: Modules.PROMOTION,
|
|
||||||
relationship: {
|
|
||||||
serviceName: LINKS.CartPromotion,
|
|
||||||
primaryKey: "promotion_id",
|
|
||||||
foreignKey: "id",
|
|
||||||
alias: "promotion_link",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export * from "./cart-product"
|
|||||||
export * from "./cart-region"
|
export * from "./cart-region"
|
||||||
export * from "./cart-sales-channel"
|
export * from "./cart-sales-channel"
|
||||||
export * from "./inventory-level-stock-location"
|
export * from "./inventory-level-stock-location"
|
||||||
|
export * from "./line-item-adjustment-promotion"
|
||||||
export * from "./order-customer"
|
export * from "./order-customer"
|
||||||
export * from "./order-product"
|
export * from "./order-product"
|
||||||
export * from "./order-sales-channel"
|
export * from "./order-sales-channel"
|
||||||
|
|||||||
+18
@@ -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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
Reference in new issue
Block a user