|
1
|
import { ModuleJoinerConfig } from "@medusajs/framework/types" |
|
2
|
import { LINKS, Modules } from "@medusajs/framework/utils" |
|
3
|
|
|
4
|
export const OrderCart: ModuleJoinerConfig = { |
|
5
|
serviceName: LINKS.OrderCart, |
|
6
|
isLink: true, |
|
7
|
databaseConfig: { |
|
8
|
tableName: "order_cart", |
|
9
|
idPrefix: "ordercart", |
|
10
|
}, |
|
11
|
alias: [ |
|
12
|
{ |
|
13
|
name: ["order_cart", "order_carts"], |
|
14
|
entity: "LinkOrderCart", |
|
15
|
}, |
|
16
|
], |
|
17
|
primaryKeys: ["id", "order_id", "cart_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.CART, |
|
32
|
entity: "Cart", |
|
33
|
primaryKey: "id", |
|
34
|
foreignKey: "cart_id", |
|
35
|
alias: "cart", |
|
36
|
args: { |
|
37
|
methodSuffix: "Carts", |
|
38
|
}, |
|
39
|
}, |
|
40
|
], |
|
41
|
extends: [ |
|
42
|
{ |
|
43
|
serviceName: Modules.ORDER, |
|
44
|
entity: "Order", |
|
45
|
fieldAlias: { |
|
46
|
cart: "cart_link.cart", |
|
47
|
}, |
|
48
|
relationship: { |
|
49
|
serviceName: LINKS.OrderCart, |
|
50
|
primaryKey: "order_id", |
|
51
|
foreignKey: "id", |
|
52
|
alias: "cart_link", |
|
53
|
}, |
|
54
|
}, |
|
55
|
{ |
|
56
|
serviceName: Modules.CART, |
|
57
|
entity: "Cart", |
|
58
|
fieldAlias: { |
|
59
|
order: "order_link.order", |
|
60
|
}, |
|
61
|
relationship: { |
|
62
|
serviceName: LINKS.OrderCart, |
|
63
|
primaryKey: "cart_id", |
|
64
|
foreignKey: "id", |
|
65
|
alias: "order_link", |
|
66
|
}, |
|
67
|
}, |
|
68
|
], |
|
69
|
} |