1 import { ModuleJoinerConfig } from "@medusajs/framework/types"
2 import { LINKS, Modules } from "@medusajs/framework/utils"
3
4 export const LocationFulfillmentProvider: ModuleJoinerConfig = {
5 serviceName: LINKS.LocationFulfillmentProvider,
6 isLink: true,
7 databaseConfig: {
8 tableName: "location_fulfillment_provider",
9 idPrefix: "locfp",
10 },
11 alias: [
12 {
13 name: ["location_fulfillment_provider", "location_fulfillment_providers"],
14 entity: "LinkLocationFulfillmentProvider",
15 },
16 ],
17 primaryKeys: ["id", "stock_location_id", "fulfillment_provider_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: { methodSuffix: "StockLocations" },
26 hasMany: true,
27 },
28 {
29 serviceName: Modules.FULFILLMENT,
30 entity: "FulfillmentProvider",
31 primaryKey: "id",
32 foreignKey: "fulfillment_provider_id",
33 alias: "fulfillment_provider",
34 args: { methodSuffix: "FulfillmentProviders" },
35 hasMany: true,
36 },
37 ],
38 extends: [
39 {
40 serviceName: Modules.STOCK_LOCATION,
41 relationship: {
42 serviceName: LINKS.LocationFulfillmentProvider,
43 primaryKey: "stock_location_id",
44 foreignKey: "id",
45 alias: "fulfillment_provider_link",
46 isList: true,
47 },
48 fieldAlias: {
49 fulfillment_providers: {
50 path: "fulfillment_provider_link.fulfillment_provider",
51 isList: true,
52 },
53 },
54 },
55 {
56 serviceName: Modules.FULFILLMENT,
57 entity: "FulfillmentProvider",
58 relationship: {
59 serviceName: LINKS.LocationFulfillmentProvider,
60 primaryKey: "fulfillment_provider_id",
61 foreignKey: "id",
62 alias: "locations_link",
63 isList: true,
64 },
65 fieldAlias: {
66 locations: {
67 path: "locations_link.location",
68 isList: true,
69 },
70 },
71 },
72 ],
73 }