feat: sales channel module (#5923)

This commit is contained in:
Frane Polić
2024-01-29 09:47:28 +01:00
committed by GitHub
parent dfd9e7c772
commit 3db2f95e65
54 changed files with 1364 additions and 61 deletions
@@ -1,5 +1,6 @@
import { MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { Modules } from "@medusajs/modules-sdk"
type HandlerInputData = {
cart: {
@@ -30,10 +31,10 @@ export async function attachCartToSalesChannel({
const salesChannel = data[Aliases.SalesChannel]
await remoteLink.create({
cartService: {
[Modules.CART]: {
cart_id: cart.id,
},
salesChannelService: {
[Modules.SALES_CHANNEL]: {
sales_channel_id: salesChannel.sales_channel_id,
},
})
@@ -1,5 +1,6 @@
import { MedusaV2Flag } from "@medusajs/utils"
import { WorkflowArguments } from "@medusajs/workflows-sdk"
import { Modules } from "@medusajs/modules-sdk"
type HandlerInputData = {
cart: {
@@ -30,10 +31,10 @@ export async function detachCartFromSalesChannel({
const salesChannel = data[Aliases.SalesChannel]
await remoteLink.dismiss({
cartService: {
[Modules.CART]: {
cart_id: cart.id,
},
salesChannelService: {
[Modules.SALES_CHANNEL]: {
sales_channel_id: salesChannel.sales_channel_id,
},
})
@@ -51,7 +51,7 @@ export async function attachSalesChannelToProducts({
[Modules.PRODUCT]: {
product_id: id,
},
salesChannelService: {
[Modules.SALES_CHANNEL]: {
sales_channel_id: salesChannelId,
},
})
@@ -49,7 +49,7 @@ export async function detachSalesChannelFromProducts({
[Modules.PRODUCT]: {
product_id: id,
},
salesChannelService: {
[Modules.SALES_CHANNEL]: {
sales_channel_id: salesChannelId,
},
})