feat: Sales Channels API routes + workflows (#6722)

**What**
- Admin sales channels API routes
- Workflows for creating, updating, and deleting sales channels
- Align `ISalesChannelModuleService` interface with update + upsert conventions
- Integrate v2 tests into v1 sales channels integration test suite
- Add metadata to sales channel entity

Sales channel <> Product management will come in a follow-up PR.

On the integration tests, creating, updating, and deleting are passing with the V2 flag enabled. You'll have to take my word for it (or run them yourself), as they are not included in the CI.
This commit is contained in:
Oli Juhl authored and GitHub committed 2024-03-18 20:57:29 +00:00
1 parent 4b06c17dc0
commit 0219a8677b
28 files changed
+1640 -1146

No files matched your search

@@ -4,8 +4,8 @@ import { ISalesChannelModuleService } from "@medusajs/types"
import { initialize } from "../../../src"
import { DB_URL, MikroOrmWrapper } from "../../utils"
import { createSalesChannels } from "../../__fixtures__"
import { DB_URL, MikroOrmWrapper } from "../../utils"
jest.setTimeout(30000)
@@ -84,13 +84,10 @@ describe("Sales Channel Service", () => {
const id = "channel-2"
it("should update the name of the SalesChannel successfully", async () => {
await service.update([
{
id,
name: "Update name 2",
is_disabled: true,
},
])
await service.update(id, {
name: "Update name 2",
is_disabled: true,
})
const channel = await service.retrieve(id)
@@ -102,11 +99,9 @@ describe("Sales Channel Service", () => {
let error
try {
await service.update([
{
id: "does-not-exist",
},
])
await service.update("does-not-exist", {
name: "does-not-exist",
})
} catch (e) {
error = e
}