1 import { ModuleJoinerConfig } from "@medusajs/framework/types"
2 import { LINKS, Modules } from "@medusajs/framework/utils"
3
4 export const CartPaymentCollection: ModuleJoinerConfig = {
5 serviceName: LINKS.CartPaymentCollection,
6 isLink: true,
7 databaseConfig: {
8 tableName: "cart_payment_collection",
9 idPrefix: "capaycol",
10 },
11 alias: [
12 {
13 name: ["cart_payment_collection", "cart_payment_collections"],
14 entity: "LinkCartPaymentCollection",
15 },
16 ],
17 primaryKeys: ["id", "cart_id", "payment_collection_id"],
18 relationships: [
19 {
20 serviceName: Modules.CART,
21 entity: "Cart",
22 primaryKey: "id",
23 foreignKey: "cart_id",
24 alias: "cart",
25 args: {
26 methodSuffix: "Carts",
27 },
28 },
29 {
30 serviceName: Modules.PAYMENT,
31 entity: "PaymentCollection",
32 primaryKey: "id",
33 foreignKey: "payment_collection_id",
34 alias: "payment_collection",
35 args: {
36 methodSuffix: "PaymentCollections",
37 },
38 hasMany: true,
39 },
40 ],
41 extends: [
42 {
43 serviceName: Modules.CART,
44 entity: "Cart",
45 fieldAlias: {
46 payment_collection: "payment_collection_link.payment_collection",
47 },
48 relationship: {
49 serviceName: LINKS.CartPaymentCollection,
50 primaryKey: "cart_id",
51 foreignKey: "id",
52 alias: "payment_collection_link",
53 },
54 },
55 {
56 serviceName: Modules.PAYMENT,
57 entity: "PaymentCollection",
58 fieldAlias: {
59 cart: "cart_link.cart",
60 },
61 relationship: {
62 serviceName: LINKS.CartPaymentCollection,
63 primaryKey: "payment_collection_id",
64 foreignKey: "id",
65 alias: "cart_link",
66 },
67 },
68 ],
69 }