feat: List shipping options for cart (#6677)

This commit is contained in:
Oli Juhl
2024-03-13 09:08:47 +00:00
committed by GitHub
parent db26dafa85
commit 25d176b851
23 changed files with 855 additions and 142 deletions
@@ -0,0 +1,63 @@
import { Modules } from "@medusajs/modules-sdk"
import { ModuleJoinerConfig } from "@medusajs/types"
import { LINKS } from "../links"
export const FulfillmentSetLocation: ModuleJoinerConfig = {
serviceName: LINKS.FulfillmentSetLocation,
isLink: true,
databaseConfig: {
tableName: "fulfillment_set_location",
idPrefix: "fsloc",
},
alias: [
{
name: ["fulfillment_set_location", "fulfillment_set_locations"],
args: {
entity: "LinkFulfillmentSetLocation",
},
},
],
primaryKeys: ["id", "fulfillment_set_id", "stock_location_id"],
relationships: [
{
serviceName: Modules.FULFILLMENT,
primaryKey: "id",
foreignKey: "fulfillment_set_id",
alias: "fulfillment_set",
},
{
serviceName: Modules.STOCK_LOCATION,
primaryKey: "id",
foreignKey: "stock_location_id",
alias: "location",
},
],
extends: [
{
serviceName: Modules.FULFILLMENT,
fieldAlias: {
stock_locations: "locations_link.location",
},
relationship: {
serviceName: LINKS.FulfillmentSetLocation,
primaryKey: "fulfillment_set_id",
foreignKey: "id",
alias: "locations_link",
isList: true,
},
},
{
serviceName: Modules.STOCK_LOCATION,
relationship: {
serviceName: LINKS.FulfillmentSetLocation,
primaryKey: "stock_location_id",
foreignKey: "id",
alias: "fulfillment_set_link",
isList: true,
},
fieldAlias: {
fulfillment_sets: "fulfillment_set_link.fulfillment_set",
},
},
],
}
@@ -3,6 +3,7 @@ export * from "./cart-payment-collection"
export * from "./cart-promotion"
export * from "./cart-region"
export * from "./cart-sales-channel"
export * from "./fulfillment-set-location"
export * from "./inventory-level-stock-location"
export * from "./order-sales-channel"
export * from "./product-sales-channel"
@@ -17,7 +17,7 @@ export const SalesChannelLocation: ModuleJoinerConfig = {
},
},
],
primaryKeys: ["id", "sales_channel_id", "location_id"],
primaryKeys: ["id", "sales_channel_id", "stock_location_id"],
relationships: [
{
serviceName: Modules.SALES_CHANNEL,
@@ -28,7 +28,7 @@ export const SalesChannelLocation: ModuleJoinerConfig = {
{
serviceName: Modules.STOCK_LOCATION,
primaryKey: "id",
foreignKey: "location_id",
foreignKey: "stock_location_id",
alias: "location",
},
],
@@ -36,7 +36,7 @@ export const SalesChannelLocation: ModuleJoinerConfig = {
{
serviceName: Modules.SALES_CHANNEL,
fieldAlias: {
locations: "locations_link.location",
stock_locations: "locations_link.location",
},
relationship: {
serviceName: LINKS.SalesChannelLocation,
@@ -53,7 +53,7 @@ export const SalesChannelLocation: ModuleJoinerConfig = {
},
relationship: {
serviceName: LINKS.SalesChannelLocation,
primaryKey: "location_id",
primaryKey: "stock_location_id",
foreignKey: "id",
alias: "sales_channels_link",
isList: true,