Files
medusa-store/packages/modules/link-modules/src/definitions/fulfillment-provider-location.ts
Harminder Virk d3e725a907 feat: add hasMany flag to enforce in app link uniqueness (#12039)
* feat: add createMultiple flag to enforce inApp link uniqueness

* changes

* mocks

* default

* many to many

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
2025-04-02 10:46:51 +02:00

74 lines
2.0 KiB
TypeScript

import { ModuleJoinerConfig } from "@medusajs/framework/types"
import { LINKS, Modules } from "@medusajs/framework/utils"
export const LocationFulfillmentProvider: ModuleJoinerConfig = {
serviceName: LINKS.LocationFulfillmentProvider,
isLink: true,
databaseConfig: {
tableName: "location_fulfillment_provider",
idPrefix: "locfp",
},
alias: [
{
name: ["location_fulfillment_provider", "location_fulfillment_providers"],
entity: "LinkLocationFulfillmentProvider",
},
],
primaryKeys: ["id", "stock_location_id", "fulfillment_provider_id"],
relationships: [
{
serviceName: Modules.STOCK_LOCATION,
entity: "StockLocation",
primaryKey: "id",
foreignKey: "stock_location_id",
alias: "location",
args: { methodSuffix: "StockLocations" },
hasMany: true,
},
{
serviceName: Modules.FULFILLMENT,
entity: "FulfillmentProvider",
primaryKey: "id",
foreignKey: "fulfillment_provider_id",
alias: "fulfillment_provider",
args: { methodSuffix: "FulfillmentProviders" },
hasMany: true,
},
],
extends: [
{
serviceName: Modules.STOCK_LOCATION,
relationship: {
serviceName: LINKS.LocationFulfillmentProvider,
primaryKey: "stock_location_id",
foreignKey: "id",
alias: "fulfillment_provider_link",
isList: true,
},
fieldAlias: {
fulfillment_providers: {
path: "fulfillment_provider_link.fulfillment_provider",
isList: true,
},
},
},
{
serviceName: Modules.FULFILLMENT,
entity: "FulfillmentProvider",
relationship: {
serviceName: LINKS.LocationFulfillmentProvider,
primaryKey: "fulfillment_provider_id",
foreignKey: "id",
alias: "locations_link",
isList: true,
},
fieldAlias: {
locations: {
path: "locations_link.location",
isList: true,
},
},
},
],
}