feat(link-modules): Cart, Payment Collection link definition (#6508)
* Add cart payment collection joiner confg * fix migration * chore: Exclude inventory tests * remove jest ignore * add back payment module
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "../links"
|
||||
|
||||
export const CartPaymentCollection: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.CartPaymentCollection,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "cart_payment_collection",
|
||||
idPrefix: "capaycol",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["cart_payment_collection", "cart_payment_collections"],
|
||||
args: {
|
||||
entity: "LinkCartPaymentCollection",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "cart_id", "payment_collection_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
primaryKey: "id",
|
||||
foreignKey: "cart_id",
|
||||
alias: "cart",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PAYMENT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "payment_collection_id",
|
||||
alias: "payment_collection",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
fieldAlias: {
|
||||
payment_collection: "payment_collection_link.payment_collection",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.CartPaymentCollection,
|
||||
primaryKey: "cart_id",
|
||||
foreignKey: "id",
|
||||
alias: "payment_collection_link",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PAYMENT,
|
||||
fieldAlias: {
|
||||
cart: "cart_link.cart",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.CartPaymentCollection,
|
||||
primaryKey: "payment_collection_id",
|
||||
foreignKey: "id",
|
||||
alias: "cart_link",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./cart-customer"
|
||||
export * from "./cart-payment-collection"
|
||||
export * from "./cart-region"
|
||||
export * from "./cart-sales-channel"
|
||||
export * from "./inventory-level-stock-location"
|
||||
|
||||
@@ -14,6 +14,12 @@ export const LINKS = {
|
||||
Modules.PRICING,
|
||||
"price_set_id"
|
||||
),
|
||||
CartPaymentCollection: composeLinkName(
|
||||
Modules.CART,
|
||||
"cart_id",
|
||||
Modules.PAYMENT,
|
||||
"payment_collection_id"
|
||||
),
|
||||
|
||||
// Internal services
|
||||
ProductShippingProfile: composeLinkName(
|
||||
|
||||
Reference in New Issue
Block a user