1 import { ModuleJoinerConfig } from "@medusajs/framework/types"
2 import { LINKS, Modules } from "@medusajs/framework/utils"
3
4 export const ProductShippingProfile: ModuleJoinerConfig = {
5 serviceName: LINKS.ProductShippingProfile,
6 isLink: true,
7 databaseConfig: {
8 tableName: "product_shipping_profile",
9 idPrefix: "prodsp",
10 },
11 alias: [
12 {
13 name: "product_shipping_profile",
14 },
15 {
16 name: "product_shipping_profiles",
17 },
18 ],
19 primaryKeys: ["id", "product_id", "shipping_profile_id"],
20 relationships: [
21 {
22 serviceName: Modules.PRODUCT,
23 entity: "Product",
24 primaryKey: "id",
25 foreignKey: "product_id",
26 alias: "product",
27 args: {
28 methodSuffix: "Products",
29 },
30 hasMany: true,
31 },
32 {
33 serviceName: Modules.FULFILLMENT,
34 entity: "ShippingProfile",
35 primaryKey: "id",
36 foreignKey: "shipping_profile_id",
37 alias: "shipping_profile",
38 args: {
39 methodSuffix: "ShippingProfiles",
40 },
41 },
42 ],
43 extends: [
44 {
45 serviceName: Modules.PRODUCT,
46 entity: "Product",
47 fieldAlias: {
48 shipping_profile: {
49 path: "shipping_profiles_link.shipping_profile",
50 isList: false,
51 },
52 },
53 relationship: {
54 serviceName: LINKS.ProductShippingProfile,
55 primaryKey: "product_id",
56 foreignKey: "id",
57 alias: "shipping_profiles_link",
58 isList: false,
59 },
60 },
61 {
62 serviceName: Modules.FULFILLMENT,
63 entity: "ShippingProfile",
64 relationship: {
65 serviceName: LINKS.ProductShippingProfile,
66 primaryKey: "shipping_profile_id",
67 foreignKey: "id",
68 alias: "products_link",
69 isList: true,
70 },
71 },
72 ],
73 }