|
1
|
import { ModuleJoinerConfig } from "@medusajs/framework/types" |
|
2
|
import { |
|
3
|
FeatureFlag, |
|
4
|
MEDUSA_SKIP_FILE, |
|
5
|
Modules, |
|
6
|
} from "@medusajs/framework/utils" |
|
7
|
|
|
8
|
export const ProductTranslation: ModuleJoinerConfig = { |
|
9
|
[MEDUSA_SKIP_FILE]: !( |
|
10
|
FeatureFlag.isFeatureEnabled("translation") || |
|
11
|
process.env.MEDUSA_FF_TRANSLATION === "true" |
|
12
|
), |
|
13
|
isLink: true, |
|
14
|
isReadOnlyLink: true, |
|
15
|
extends: [ |
|
16
|
{ |
|
17
|
serviceName: Modules.PRODUCT, |
|
18
|
entity: "Product", |
|
19
|
relationship: { |
|
20
|
serviceName: Modules.TRANSLATION, |
|
21
|
entity: "Translation", |
|
22
|
primaryKey: "reference_id", |
|
23
|
foreignKey: "id", |
|
24
|
alias: "translations", |
|
25
|
isList: true, |
|
26
|
args: { |
|
27
|
methodSuffix: "Translations", |
|
28
|
}, |
|
29
|
}, |
|
30
|
}, |
|
31
|
{ |
|
32
|
serviceName: Modules.PRODUCT, |
|
33
|
entity: "ProductVariant", |
|
34
|
relationship: { |
|
35
|
serviceName: Modules.TRANSLATION, |
|
36
|
entity: "Translation", |
|
37
|
primaryKey: "reference_id", |
|
38
|
foreignKey: "id", |
|
39
|
alias: "translations", |
|
40
|
isList: true, |
|
41
|
args: { |
|
42
|
methodSuffix: "Translations", |
|
43
|
}, |
|
44
|
}, |
|
45
|
}, |
|
46
|
{ |
|
47
|
serviceName: Modules.PRODUCT, |
|
48
|
entity: "ProductCategory", |
|
49
|
relationship: { |
|
50
|
serviceName: Modules.TRANSLATION, |
|
51
|
entity: "Translation", |
|
52
|
primaryKey: "reference_id", |
|
53
|
foreignKey: "id", |
|
54
|
alias: "translations", |
|
55
|
isList: true, |
|
56
|
args: { |
|
57
|
methodSuffix: "Translations", |
|
58
|
}, |
|
59
|
}, |
|
60
|
}, |
|
61
|
{ |
|
62
|
serviceName: Modules.PRODUCT, |
|
63
|
entity: "ProductCollection", |
|
64
|
relationship: { |
|
65
|
serviceName: Modules.TRANSLATION, |
|
66
|
entity: "Translation", |
|
67
|
primaryKey: "reference_id", |
|
68
|
foreignKey: "id", |
|
69
|
alias: "translations", |
|
70
|
isList: true, |
|
71
|
args: { |
|
72
|
methodSuffix: "Translations", |
|
73
|
}, |
|
74
|
}, |
|
75
|
}, |
|
76
|
{ |
|
77
|
serviceName: Modules.PRODUCT, |
|
78
|
entity: "ProductTag", |
|
79
|
relationship: { |
|
80
|
serviceName: Modules.TRANSLATION, |
|
81
|
entity: "Translation", |
|
82
|
primaryKey: "reference_id", |
|
83
|
foreignKey: "id", |
|
84
|
alias: "translations", |
|
85
|
isList: true, |
|
86
|
args: { |
|
87
|
methodSuffix: "Translations", |
|
88
|
}, |
|
89
|
}, |
|
90
|
}, |
|
91
|
{ |
|
92
|
serviceName: Modules.PRODUCT, |
|
93
|
entity: "ProductType", |
|
94
|
relationship: { |
|
95
|
serviceName: Modules.TRANSLATION, |
|
96
|
entity: "Translation", |
|
97
|
primaryKey: "reference_id", |
|
98
|
foreignKey: "id", |
|
99
|
alias: "translations", |
|
100
|
isList: true, |
|
101
|
args: { |
|
102
|
methodSuffix: "Translations", |
|
103
|
}, |
|
104
|
}, |
|
105
|
}, |
|
106
|
{ |
|
107
|
serviceName: Modules.PRODUCT, |
|
108
|
entity: "ProductOption", |
|
109
|
relationship: { |
|
110
|
serviceName: Modules.TRANSLATION, |
|
111
|
entity: "Translation", |
|
112
|
primaryKey: "reference_id", |
|
113
|
foreignKey: "id", |
|
114
|
alias: "translations", |
|
115
|
isList: true, |
|
116
|
args: { |
|
117
|
methodSuffix: "Translations", |
|
118
|
}, |
|
119
|
}, |
|
120
|
}, |
|
121
|
{ |
|
122
|
serviceName: Modules.PRODUCT, |
|
123
|
entity: "ProductOptionValue", |
|
124
|
relationship: { |
|
125
|
serviceName: Modules.TRANSLATION, |
|
126
|
entity: "Translation", |
|
127
|
primaryKey: "reference_id", |
|
128
|
foreignKey: "id", |
|
129
|
alias: "translations", |
|
130
|
isList: true, |
|
131
|
args: { |
|
132
|
methodSuffix: "Translations", |
|
133
|
}, |
|
134
|
}, |
|
135
|
}, |
|
136
|
{ |
|
137
|
serviceName: Modules.TRANSLATION, |
|
138
|
entity: "Translation", |
|
139
|
relationship: { |
|
140
|
serviceName: Modules.PRODUCT, |
|
141
|
entity: "Product", |
|
142
|
primaryKey: "id", |
|
143
|
foreignKey: "reference_id", |
|
144
|
alias: "product", |
|
145
|
args: { |
|
146
|
methodSuffix: "Products", |
|
147
|
}, |
|
148
|
}, |
|
149
|
}, |
|
150
|
], |
|
151
|
} as ModuleJoinerConfig |