chore(): Reorganize modules (#7210)
**What** Move all modules to the modules directory
This commit is contained in:
committed by
GitHub
parent
7a351eef09
commit
4eae25e1ef
@@ -0,0 +1,28 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
export const CartCustomer: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
relationship: {
|
||||
serviceName: Modules.CUSTOMER,
|
||||
primaryKey: "id",
|
||||
foreignKey: "customer_id",
|
||||
alias: "customer",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.CUSTOMER,
|
||||
relationship: {
|
||||
serviceName: Modules.CART,
|
||||
primaryKey: "customer_id",
|
||||
foreignKey: "id",
|
||||
alias: "carts",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
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",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const CartPromotion: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.CartPromotion,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "cart_promotion",
|
||||
idPrefix: "cartpromo",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["cart_promotion", "cart_promotions"],
|
||||
args: {
|
||||
entity: "LinkCartPromotion",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "cart_id", "promotion_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
primaryKey: "id",
|
||||
foreignKey: "cart_id",
|
||||
alias: "cart",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PROMOTION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "promotion_id",
|
||||
alias: "promotion",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
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",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
28
packages/modules/link-modules/src/definitions/cart-region.ts
Normal file
28
packages/modules/link-modules/src/definitions/cart-region.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
export const CartRegion: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
relationship: {
|
||||
serviceName: Modules.REGION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "region_id",
|
||||
alias: "region",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.REGION,
|
||||
relationship: {
|
||||
serviceName: Modules.CART,
|
||||
primaryKey: "region_id",
|
||||
foreignKey: "id",
|
||||
alias: "carts",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
export const CartSalesChannel: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.CART,
|
||||
relationship: {
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
primaryKey: "id",
|
||||
foreignKey: "sales_channel_id",
|
||||
alias: "sales_channel",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
relationship: {
|
||||
serviceName: Modules.CART,
|
||||
primaryKey: "sales_channel_id",
|
||||
foreignKey: "id",
|
||||
alias: "carts",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const FulfillmentSetLocation: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.FulfillmentSetLocation,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "fulfillment_set_location",
|
||||
idPrefix: "fsloc",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["fulfillment_set_location", "fulfillment_set_locations"],
|
||||
args: {
|
||||
entity: "LinkFulfillmentSetLocation",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "fulfillment_set_id", "stock_location_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.FULFILLMENT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "fulfillment_set_id",
|
||||
alias: "fulfillment_set",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.STOCK_LOCATION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "stock_location_id",
|
||||
alias: "location",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.FULFILLMENT,
|
||||
fieldAlias: {
|
||||
stock_locations: "locations_link.location",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.FulfillmentSetLocation,
|
||||
primaryKey: "fulfillment_set_id",
|
||||
foreignKey: "id",
|
||||
alias: "locations_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.STOCK_LOCATION,
|
||||
relationship: {
|
||||
serviceName: LINKS.FulfillmentSetLocation,
|
||||
primaryKey: "stock_location_id",
|
||||
foreignKey: "id",
|
||||
alias: "fulfillment_set_link",
|
||||
isList: true,
|
||||
},
|
||||
fieldAlias: {
|
||||
fulfillment_sets: "fulfillment_set_link.fulfillment_set",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
20
packages/modules/link-modules/src/definitions/index.ts
Normal file
20
packages/modules/link-modules/src/definitions/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export * from "./cart-customer"
|
||||
export * from "./cart-payment-collection"
|
||||
export * from "./cart-promotion"
|
||||
export * from "./cart-region"
|
||||
export * from "./cart-sales-channel"
|
||||
export * from "./fulfillment-set-location"
|
||||
export * from "./inventory-level-stock-location"
|
||||
export * from "./order-customer"
|
||||
export * from "./order-promotion"
|
||||
export * from "./order-region"
|
||||
export * from "./order-sales-channel"
|
||||
export * from "./product-sales-channel"
|
||||
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 "./region-payment-provider"
|
||||
export * from "./sales-channel-location"
|
||||
export * from "./shipping-option-price-set"
|
||||
export * from "./store-default-currency"
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
|
||||
export const InventoryLevelStockLocation: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.INVENTORY,
|
||||
relationship: {
|
||||
serviceName: Modules.STOCK_LOCATION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "location_id",
|
||||
alias: "stock_locations",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
export const OrderCustomer: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.ORDER,
|
||||
relationship: {
|
||||
serviceName: Modules.CUSTOMER,
|
||||
primaryKey: "id",
|
||||
foreignKey: "customer_id",
|
||||
alias: "customer",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.CUSTOMER,
|
||||
relationship: {
|
||||
serviceName: Modules.ORDER,
|
||||
primaryKey: "customer_id",
|
||||
foreignKey: "id",
|
||||
alias: "orders",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const OrderPromotion: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.OrderPromotion,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "order_promotion",
|
||||
idPrefix: "orderpromo",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["order_promotion", "order_promotions"],
|
||||
args: {
|
||||
entity: "LinkOrderPromotion",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "order_id", "promotion_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.ORDER,
|
||||
primaryKey: "id",
|
||||
foreignKey: "order_id",
|
||||
alias: "order",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PROMOTION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "promotion_id",
|
||||
alias: "promotion",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.ORDER,
|
||||
relationship: {
|
||||
serviceName: LINKS.OrderPromotion,
|
||||
primaryKey: "order_id",
|
||||
foreignKey: "id",
|
||||
alias: "order_link",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PROMOTION,
|
||||
relationship: {
|
||||
serviceName: LINKS.OrderPromotion,
|
||||
primaryKey: "promotion_id",
|
||||
foreignKey: "id",
|
||||
alias: "promotion_link",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
export const OrderRegion: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.ORDER,
|
||||
relationship: {
|
||||
serviceName: Modules.REGION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "region_id",
|
||||
alias: "region",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.REGION,
|
||||
relationship: {
|
||||
serviceName: Modules.ORDER,
|
||||
primaryKey: "region_id",
|
||||
foreignKey: "id",
|
||||
alias: "orders",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const OrderSalesChannel: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.OrderSalesChannel,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "order_sales_channel",
|
||||
idPrefix: "ordersc",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: "order_sales_channel",
|
||||
},
|
||||
{
|
||||
name: "order_sales_channels",
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "order_id", "sales_channel_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.ORDER,
|
||||
isInternalService: true,
|
||||
primaryKey: "id",
|
||||
foreignKey: "order_id",
|
||||
alias: "order",
|
||||
},
|
||||
{
|
||||
serviceName: "salesChannelService",
|
||||
isInternalService: true,
|
||||
primaryKey: "id",
|
||||
foreignKey: "sales_channel_id",
|
||||
alias: "sales_channel",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.ORDER,
|
||||
fieldAlias: {
|
||||
sales_channel: "sales_channel_link.sales_channel",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.OrderSalesChannel,
|
||||
isInternalService: true,
|
||||
primaryKey: "order_id",
|
||||
foreignKey: "id",
|
||||
alias: "sales_channel_link",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: "salesChannelService",
|
||||
fieldAlias: {
|
||||
orders: "order_link.order",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.OrderSalesChannel,
|
||||
isInternalService: true,
|
||||
primaryKey: "sales_channel_id",
|
||||
foreignKey: "id",
|
||||
alias: "order_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const ProductSalesChannel: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.ProductSalesChannel,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "product_sales_channel",
|
||||
idPrefix: "prodsc",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: "product_sales_channel",
|
||||
},
|
||||
{
|
||||
name: "product_sales_channels",
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "product_id", "sales_channel_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "product_id",
|
||||
alias: "product",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
isInternalService: true,
|
||||
primaryKey: "id",
|
||||
foreignKey: "sales_channel_id",
|
||||
alias: "sales_channel",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
fieldAlias: {
|
||||
sales_channels: "sales_channels_link.sales_channel",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductSalesChannel,
|
||||
primaryKey: "product_id",
|
||||
foreignKey: "id",
|
||||
alias: "sales_channels_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductSalesChannel,
|
||||
isInternalService: true,
|
||||
primaryKey: "sales_channel_id",
|
||||
foreignKey: "id",
|
||||
alias: "products_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const ProductShippingProfile: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.ProductShippingProfile,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "product_shipping_profile",
|
||||
idPrefix: "psprof",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: "product_shipping_profile",
|
||||
args: {
|
||||
entity: "LinkProductShippingProfile",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "product_id", "profile_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "product_id",
|
||||
alias: "product",
|
||||
},
|
||||
{
|
||||
serviceName: "shippingProfileService",
|
||||
isInternalService: true,
|
||||
primaryKey: "id",
|
||||
foreignKey: "profile_id",
|
||||
alias: "profile",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
fieldAlias: {
|
||||
profile: "shipping_profile.profile",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductShippingProfile,
|
||||
primaryKey: "product_id",
|
||||
foreignKey: "id",
|
||||
alias: "shipping_profile",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: "shippingProfileService",
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductShippingProfile,
|
||||
isInternalService: true,
|
||||
primaryKey: "profile_id",
|
||||
foreignKey: "id",
|
||||
alias: "product_link",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const ProductVariantInventoryItem: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.ProductVariantInventoryItem,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "product_variant_inventory_item",
|
||||
idPrefix: "pvitem",
|
||||
extraFields: {
|
||||
required_quantity: {
|
||||
type: "integer",
|
||||
defaultValue: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: [
|
||||
"product_variant_inventory_item",
|
||||
"product_variant_inventory_items",
|
||||
],
|
||||
args: {
|
||||
entity: "LinkProductVariantInventoryItem",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "variant_id", "inventory_item_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "variant_id",
|
||||
alias: "variant",
|
||||
args: {
|
||||
methodSuffix: "Variants",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.INVENTORY,
|
||||
primaryKey: "id",
|
||||
foreignKey: "inventory_item_id",
|
||||
alias: "inventory",
|
||||
deleteCascade: true,
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
fieldAlias: {
|
||||
inventory: "inventory_items.inventory",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductVariantInventoryItem,
|
||||
primaryKey: "variant_id",
|
||||
foreignKey: "id",
|
||||
alias: "inventory_items",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.INVENTORY,
|
||||
fieldAlias: {
|
||||
variant: "variant_link.variant",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductVariantInventoryItem,
|
||||
primaryKey: "inventory_item_id",
|
||||
foreignKey: "id",
|
||||
alias: "variant_link",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const ProductVariantPriceSet: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.ProductVariantPriceSet,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "product_variant_price_set",
|
||||
idPrefix: "pvps",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["product_variant_price_set", "product_variant_price_sets"],
|
||||
args: {
|
||||
entity: "LinkProductVariantPriceSet",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "variant_id", "price_set_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
// TODO: Remove this when product module is the default product service
|
||||
isInternalService: true,
|
||||
primaryKey: "id",
|
||||
foreignKey: "variant_id",
|
||||
alias: "variant",
|
||||
args: {
|
||||
methodSuffix: "Variants",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PRICING,
|
||||
primaryKey: "id",
|
||||
foreignKey: "price_set_id",
|
||||
alias: "price_set",
|
||||
deleteCascade: true,
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.PRODUCT,
|
||||
fieldAlias: {
|
||||
price_set: "price_set_link.price_set",
|
||||
prices: "price_set_link.price_set.prices",
|
||||
calculated_price: {
|
||||
path: "price_set_link.price_set.calculated_price",
|
||||
forwardArgumentsOnPath: ["price_set_link.price_set"],
|
||||
},
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductVariantPriceSet,
|
||||
primaryKey: "variant_id",
|
||||
foreignKey: "id",
|
||||
alias: "price_set_link",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PRICING,
|
||||
relationship: {
|
||||
serviceName: LINKS.ProductVariantPriceSet,
|
||||
primaryKey: "price_set_id",
|
||||
foreignKey: "id",
|
||||
alias: "variant_link",
|
||||
},
|
||||
fieldAlias: {
|
||||
variant: "variant_link.variant",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const PublishableApiKeySalesChannel: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.PublishableApiKeySalesChannel,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "publishable_api_key_sales_channel",
|
||||
idPrefix: "pksc",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: [
|
||||
"publishable_api_key_sales_channel",
|
||||
"publishable_api_key_sales_channels",
|
||||
],
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "publishable_key_id", "sales_channel_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.API_KEY,
|
||||
primaryKey: "id",
|
||||
foreignKey: "publishable_key_id",
|
||||
alias: "api_key",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
primaryKey: "id",
|
||||
foreignKey: "sales_channel_id",
|
||||
alias: "sales_channel",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.API_KEY,
|
||||
fieldAlias: {
|
||||
sales_channels: "sales_channels_link.sales_channel",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.PublishableApiKeySalesChannel,
|
||||
primaryKey: "publishable_key_id",
|
||||
foreignKey: "id",
|
||||
alias: "sales_channels_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
fieldAlias: {
|
||||
publishable_api_keys: "api_keys_link.api_key",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.PublishableApiKeySalesChannel,
|
||||
primaryKey: "sales_channel_id",
|
||||
foreignKey: "id",
|
||||
alias: "api_keys_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const RegionPaymentProvider: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.RegionPaymentProvider,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "region_payment_provider",
|
||||
idPrefix: "regpp",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["region_payment_provider", "region_payment_providers"],
|
||||
args: {
|
||||
entity: "LinkRegionPaymentProvider",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "region_id", "payment_provider_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.REGION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "region_id",
|
||||
alias: "region",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PAYMENT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "payment_provider_id",
|
||||
alias: "payment_provider",
|
||||
args: { methodSuffix: "PaymentProviders" },
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.REGION,
|
||||
fieldAlias: {
|
||||
payment_providers: "payment_provider_link.payment_provider",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.RegionPaymentProvider,
|
||||
primaryKey: "region_id",
|
||||
foreignKey: "id",
|
||||
alias: "payment_provider_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PAYMENT,
|
||||
fieldAlias: {
|
||||
regions: "region_link.region",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.RegionPaymentProvider,
|
||||
primaryKey: "payment_provider_id",
|
||||
foreignKey: "id",
|
||||
alias: "region_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const SalesChannelLocation: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.SalesChannelLocation,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "sales_channel_stock_location",
|
||||
idPrefix: "scloc",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["sales_channel_location", "sales_channel_locations"],
|
||||
args: {
|
||||
entity: "LinkSalesChannelLocation",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "sales_channel_id", "stock_location_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
primaryKey: "id",
|
||||
foreignKey: "sales_channel_id",
|
||||
alias: "sales_channel",
|
||||
},
|
||||
{
|
||||
serviceName: Modules.STOCK_LOCATION,
|
||||
primaryKey: "id",
|
||||
foreignKey: "stock_location_id",
|
||||
alias: "location",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.SALES_CHANNEL,
|
||||
fieldAlias: {
|
||||
stock_locations: "locations_link.location",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.SalesChannelLocation,
|
||||
primaryKey: "sales_channel_id",
|
||||
foreignKey: "id",
|
||||
alias: "locations_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.STOCK_LOCATION,
|
||||
fieldAlias: {
|
||||
sales_channels: "sales_channels_link.sales_channel",
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.SalesChannelLocation,
|
||||
primaryKey: "stock_location_id",
|
||||
foreignKey: "id",
|
||||
alias: "sales_channels_link",
|
||||
isList: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
import { LINKS } from "@medusajs/utils"
|
||||
|
||||
export const ShippingOptionPriceSet: ModuleJoinerConfig = {
|
||||
serviceName: LINKS.ShippingOptionPriceSet,
|
||||
isLink: true,
|
||||
databaseConfig: {
|
||||
tableName: "shipping_option_price_set",
|
||||
idPrefix: "sops",
|
||||
},
|
||||
alias: [
|
||||
{
|
||||
name: ["shipping_option_price_set", "shipping_option_price_sets"],
|
||||
args: {
|
||||
entity: "LinkShippingOptionPriceSet",
|
||||
},
|
||||
},
|
||||
],
|
||||
primaryKeys: ["id", "shipping_option_id", "price_set_id"],
|
||||
relationships: [
|
||||
{
|
||||
serviceName: Modules.FULFILLMENT,
|
||||
primaryKey: "id",
|
||||
foreignKey: "shipping_option_id",
|
||||
alias: "shipping_option",
|
||||
args: {
|
||||
methodSuffix: "ShippingOptions",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PRICING,
|
||||
primaryKey: "id",
|
||||
foreignKey: "price_set_id",
|
||||
alias: "price_set",
|
||||
deleteCascade: true,
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.FULFILLMENT,
|
||||
fieldAlias: {
|
||||
prices: {
|
||||
path: "price_set_link.price_set.prices",
|
||||
isList: true,
|
||||
},
|
||||
calculated_price: {
|
||||
path: "price_set_link.price_set.calculated_price",
|
||||
forwardArgumentsOnPath: ["price_set_link.price_set"],
|
||||
},
|
||||
},
|
||||
relationship: {
|
||||
serviceName: LINKS.ShippingOptionPriceSet,
|
||||
primaryKey: "shipping_option_id",
|
||||
foreignKey: "id",
|
||||
alias: "price_set_link",
|
||||
},
|
||||
},
|
||||
{
|
||||
serviceName: Modules.PRICING,
|
||||
relationship: {
|
||||
serviceName: LINKS.ShippingOptionPriceSet,
|
||||
primaryKey: "price_set_id",
|
||||
foreignKey: "id",
|
||||
alias: "shipping_option_link",
|
||||
},
|
||||
fieldAlias: {
|
||||
shipping_option: "shipping_option_link.shipping_option",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Modules } from "@medusajs/modules-sdk"
|
||||
import { ModuleJoinerConfig } from "@medusajs/types"
|
||||
|
||||
export const StoreDefaultCurrency: ModuleJoinerConfig = {
|
||||
isLink: true,
|
||||
isReadOnlyLink: true,
|
||||
extends: [
|
||||
{
|
||||
serviceName: Modules.STORE,
|
||||
relationship: {
|
||||
serviceName: Modules.CURRENCY,
|
||||
primaryKey: "code",
|
||||
foreignKey: "default_currency_code",
|
||||
alias: "default_currency",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user