|
1
|
import { ModuleJoinerConfig } from "@medusajs/framework/types" |
|
2
|
import { LINKS, Modules } from "@medusajs/framework/utils" |
|
3
|
|
|
4
|
export const ProductVariantPriceSet: ModuleJoinerConfig = { |
|
5
|
serviceName: LINKS.ProductVariantPriceSet, |
|
6
|
isLink: true, |
|
7
|
databaseConfig: { |
|
8
|
tableName: "product_variant_price_set", |
|
9
|
idPrefix: "pvps", |
|
10
|
}, |
|
11
|
alias: [ |
|
12
|
{ |
|
13
|
name: ["product_variant_price_set", "product_variant_price_sets"], |
|
14
|
entity: "LinkProductVariantPriceSet", |
|
15
|
}, |
|
16
|
], |
|
17
|
primaryKeys: ["id", "variant_id", "price_set_id"], |
|
18
|
relationships: [ |
|
19
|
{ |
|
20
|
serviceName: Modules.PRODUCT, |
|
21
|
entity: "ProductVariant", |
|
22
|
primaryKey: "id", |
|
23
|
foreignKey: "variant_id", |
|
24
|
alias: "variant", |
|
25
|
args: { |
|
26
|
methodSuffix: "ProductVariants", |
|
27
|
}, |
|
28
|
}, |
|
29
|
{ |
|
30
|
serviceName: Modules.PRICING, |
|
31
|
entity: "PriceSet", |
|
32
|
primaryKey: "id", |
|
33
|
foreignKey: "price_set_id", |
|
34
|
alias: "price_set", |
|
35
|
args: { |
|
36
|
methodSuffix: "PriceSets", |
|
37
|
}, |
|
38
|
deleteCascade: true, |
|
39
|
}, |
|
40
|
], |
|
41
|
extends: [ |
|
42
|
{ |
|
43
|
serviceName: Modules.PRODUCT, |
|
44
|
entity: "ProductVariant", |
|
45
|
fieldAlias: { |
|
46
|
price_set: "price_set_link.price_set", |
|
47
|
prices: { |
|
48
|
path: "price_set_link.price_set.prices", |
|
49
|
isList: true, |
|
50
|
forwardArgumentsOnPath: ["price_set_link.price_set"], |
|
51
|
}, |
|
52
|
calculated_price: { |
|
53
|
path: "price_set_link.price_set.calculated_price", |
|
54
|
forwardArgumentsOnPath: ["price_set_link.price_set"], |
|
55
|
}, |
|
56
|
}, |
|
57
|
relationship: { |
|
58
|
serviceName: LINKS.ProductVariantPriceSet, |
|
59
|
primaryKey: "variant_id", |
|
60
|
foreignKey: "id", |
|
61
|
alias: "price_set_link", |
|
62
|
}, |
|
63
|
}, |
|
64
|
{ |
|
65
|
serviceName: Modules.PRICING, |
|
66
|
entity: "PriceSet", |
|
67
|
relationship: { |
|
68
|
serviceName: LINKS.ProductVariantPriceSet, |
|
69
|
primaryKey: "price_set_id", |
|
70
|
foreignKey: "id", |
|
71
|
alias: "variant_link", |
|
72
|
}, |
|
73
|
fieldAlias: { |
|
74
|
variant: "variant_link.variant", |
|
75
|
}, |
|
76
|
}, |
|
77
|
], |
|
78
|
} |