Raw
1 import { defineJoinerConfig, Modules } from "@medusajs/framework/utils"
2 import {
3 Product,
4 ProductCategory,
5 ProductCollection,
6 ProductImage,
7 ProductOption,
8 ProductOptionValue,
9 ProductTag,
10 ProductType,
11 ProductVariant,
12 } from "@models"
13 import { default as schema } from "./schema"
14
15 export const joinerConfig = defineJoinerConfig(Modules.PRODUCT, {
16 schema,
17 models: [
18 Product,
19 ProductVariant,
20 ProductOption,
21 ProductOptionValue,
22 ProductType,
23 ProductTag,
24 ProductCollection,
25 ProductCategory,
26 ProductImage,
27 ],
28 linkableKeys: {
29 // Merged with the autogenerated ones to maintain backward compatibility
30 variant_id: "ProductVariant",
31 },
32 primaryKeys: ["id", "handle"],
33 alias: [
34 {
35 name: ["product_variant", "product_variants", "variant", "variants"],
36 entity: "ProductVariant",
37 args: {
38 methodSuffix: "ProductVariants",
39 },
40 },
41 ],
42 })