chore: Migrate modules to use the Module util (#7964)
**What** Apply the `Module` util to each module to handle the export and provide the linkable configuration object. - Most joiner config that does not have any special config are removed/cleaned up in favor of the autogenerated one or simpler one - linkable are now available in all modules - cleaned up the dependencies of the modules FIXES CORE-2410
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { ModuleExports } from "@medusajs/types"
|
||||
import { Module, Modules } from "@medusajs/utils"
|
||||
import { ProductModuleService } from "@services"
|
||||
|
||||
const moduleDefinition: ModuleExports = {
|
||||
export default Module(Modules.PRODUCT, {
|
||||
service: ProductModuleService,
|
||||
}
|
||||
export default moduleDefinition
|
||||
})
|
||||
|
||||
@@ -1,56 +1,33 @@
|
||||
import { defineJoinerConfig, Modules } from "@medusajs/utils"
|
||||
import {
|
||||
Product,
|
||||
ProductCategory,
|
||||
ProductCollection,
|
||||
ProductOption,
|
||||
ProductTag,
|
||||
ProductType,
|
||||
ProductVariant,
|
||||
} from "@models"
|
||||
import ProductImage from "./models/product-image"
|
||||
|
||||
export const joinerConfig = defineJoinerConfig(Modules.PRODUCT, {
|
||||
models: [
|
||||
Product,
|
||||
ProductVariant,
|
||||
ProductOption,
|
||||
ProductType,
|
||||
ProductImage,
|
||||
ProductTag,
|
||||
ProductCollection,
|
||||
ProductCategory,
|
||||
],
|
||||
primaryKeys: ["id", "handle"],
|
||||
// This module provides more alias than the default config builder
|
||||
alias: [
|
||||
{
|
||||
name: ["product", "products"],
|
||||
args: {
|
||||
entity: "Product",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_variant", "product_variants", "variant", "variants"],
|
||||
args: {
|
||||
entity: "ProductVariant",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_option", "product_options"],
|
||||
args: {
|
||||
entity: "ProductOption",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_type", "product_types"],
|
||||
args: {
|
||||
entity: "ProductType",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_image", "product_images"],
|
||||
args: {
|
||||
entity: "ProductImage",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_tag", "product_tags"],
|
||||
args: {
|
||||
entity: "ProductTag",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_collection", "product_collections"],
|
||||
args: {
|
||||
entity: "ProductCollection",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: ["product_category", "product_categories"],
|
||||
args: {
|
||||
entity: "ProductCategory",
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user