1 import { ModuleJoinerConfig } from "@medusajs/framework/types"
2 import { LINKS, Modules } from "@medusajs/framework/utils"
3
4 export const LocationFulfillmentSet: ModuleJoinerConfig = {
5 serviceName: LINKS.LocationFulfillmentSet,
6 isLink: true,
7 databaseConfig: {
8 tableName: "location_fulfillment_set",
9 idPrefix: "locfs",
10 },
11 alias: [
12 {
13 name: ["location_fulfillment_set", "location_fulfillment_sets"],
14 entity: "LinkLocationFulfillmentSet",
15 },
16 ],
17 primaryKeys: ["id", "stock_location_id", "fulfillment_set_id"],
18 relationships: [
19 {
20 serviceName: Modules.STOCK_LOCATION,
21 entity: "StockLocation",
22 primaryKey: "id",
23 foreignKey: "stock_location_id",
24 alias: "location",
25 args: {
26 methodSuffix: "StockLocations",
27 },
28 },
29 {
30 serviceName: Modules.FULFILLMENT,
31 entity: "FulfillmentSet",
32 primaryKey: "id",
33 foreignKey: "fulfillment_set_id",
34 alias: "fulfillment_set",
35 args: {
36 methodSuffix: "FulfillmentSets",
37 },
38 deleteCascade: true,
39 hasMany: true,
40 },
41 ],
42 extends: [
43 {
44 serviceName: Modules.STOCK_LOCATION,
45 relationship: {
46 serviceName: LINKS.LocationFulfillmentSet,
47 primaryKey: "stock_location_id",
48 foreignKey: "id",
49 alias: "fulfillment_set_link",
50 isList: true,
51 },
52 fieldAlias: {
53 fulfillment_sets: {
54 path: "fulfillment_set_link.fulfillment_set",
55 isList: true,
56 },
57 },
58 },
59 {
60 serviceName: Modules.FULFILLMENT,
61 entity: "FulfillmentSet",
62 fieldAlias: {
63 location: "locations_link.location",
64 },
65 relationship: {
66 serviceName: LINKS.LocationFulfillmentSet,
67 primaryKey: "fulfillment_set_id",
68 foreignKey: "id",
69 alias: "locations_link",
70 },
71 },
72 ],
73 }