feat(medusa): Prevent default channel from being deleted (#1835)

**What**
Prevent the default channel from being deleted

Fixes CORE-317
This commit is contained in:
Oliver Windall Juhl
2022-07-13 06:41:03 +00:00
committed by GitHub
parent e539bdc620
commit 4e375c2203
8 changed files with 272 additions and 57 deletions
@@ -1,11 +1,12 @@
import { Connection } from "typeorm"
import faker from "faker"
import { SalesChannel } from "@medusajs/medusa"
import faker from "faker"
import { Connection } from "typeorm"
export type SalesChannelFactoryData = {
name?: string
description?: string
is_disabled?: boolean
id?: string
}
export const simpleSalesChannelFactory = async (
@@ -20,7 +21,7 @@ export const simpleSalesChannelFactory = async (
const manager = connection.manager
const salesChannel = manager.create(SalesChannel, {
id: `simple-id-${Math.random() * 1000}`,
id: data.id ?? `simple-id-${Math.random() * 1000}`,
name: data.name || faker.name.firstName(),
description: data.description || faker.name.lastName(),
is_disabled: