|
1
|
import { ModuleJoinerConfig } from "@medusajs/framework/types" |
|
2
|
import { LINKS, Modules } from "@medusajs/framework/utils" |
|
3
|
|
|
4
|
export const OrderPromotion: ModuleJoinerConfig = { |
|
5
|
serviceName: LINKS.OrderPromotion, |
|
6
|
isLink: true, |
|
7
|
databaseConfig: { |
|
8
|
tableName: "order_promotion", |
|
9
|
idPrefix: "orderpromo", |
|
10
|
}, |
|
11
|
alias: [ |
|
12
|
{ |
|
13
|
name: ["order_promotion", "order_promotions"], |
|
14
|
entity: "LinkOrderPromotion", |
|
15
|
}, |
|
16
|
], |
|
17
|
primaryKeys: ["id", "order_id", "promotion_id"], |
|
18
|
relationships: [ |
|
19
|
{ |
|
20
|
serviceName: Modules.ORDER, |
|
21
|
entity: "Order", |
|
22
|
primaryKey: "id", |
|
23
|
foreignKey: "order_id", |
|
24
|
alias: "order", |
|
25
|
args: { |
|
26
|
methodSuffix: "Orders", |
|
27
|
}, |
|
28
|
hasMany: true, |
|
29
|
}, |
|
30
|
{ |
|
31
|
serviceName: Modules.PROMOTION, |
|
32
|
entity: "Promotion", |
|
33
|
primaryKey: "id", |
|
34
|
foreignKey: "promotion_id", |
|
35
|
alias: "promotions", |
|
36
|
args: { |
|
37
|
methodSuffix: "Promotions", |
|
38
|
}, |
|
39
|
hasMany: true, |
|
40
|
}, |
|
41
|
], |
|
42
|
extends: [ |
|
43
|
{ |
|
44
|
serviceName: Modules.ORDER, |
|
45
|
entity: "Order", |
|
46
|
fieldAlias: { |
|
47
|
promotions: { |
|
48
|
path: "promotion_link.promotions", |
|
49
|
isList: true, |
|
50
|
}, |
|
51
|
/** |
|
52
|
* @deprecated use the promotions field alias instead |
|
53
|
*/ |
|
54
|
promotion: { |
|
55
|
path: "promotion_link.promotions", |
|
56
|
isList: true, |
|
57
|
}, |
|
58
|
}, |
|
59
|
relationship: { |
|
60
|
serviceName: LINKS.OrderPromotion, |
|
61
|
primaryKey: "order_id", |
|
62
|
foreignKey: "id", |
|
63
|
alias: "promotion_link", |
|
64
|
isList: true, |
|
65
|
}, |
|
66
|
}, |
|
67
|
{ |
|
68
|
serviceName: Modules.PROMOTION, |
|
69
|
entity: "Promotion", |
|
70
|
relationship: { |
|
71
|
serviceName: LINKS.OrderPromotion, |
|
72
|
primaryKey: "promotion_id", |
|
73
|
foreignKey: "id", |
|
74
|
alias: "order_link", |
|
75
|
}, |
|
76
|
}, |
|
77
|
], |
|
78
|
} |