chore(): Reorganize modules (#7210)
**What** Move all modules to the modules directory
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { SalesChannel } from "@models"
|
||||
|
||||
const salesChannelData = [
|
||||
{
|
||||
id: "channel-1",
|
||||
name: "Channel 1",
|
||||
description: "Channel description 1",
|
||||
is_disabled: false,
|
||||
},
|
||||
{
|
||||
id: "channel-2",
|
||||
name: "Channel 2",
|
||||
description: "Channel description 2",
|
||||
is_disabled: false,
|
||||
},
|
||||
{
|
||||
id: "channel-3",
|
||||
name: "Channel 3",
|
||||
description: "Channel description 3",
|
||||
is_disabled: true,
|
||||
},
|
||||
]
|
||||
|
||||
export async function createSalesChannels(
|
||||
manager: SqlEntityManager,
|
||||
channelData: any[] = salesChannelData
|
||||
): Promise<SalesChannel[]> {
|
||||
const channels: SalesChannel[] = []
|
||||
|
||||
for (let data of channelData) {
|
||||
const sc = manager.create(SalesChannel, data)
|
||||
|
||||
channels.push(sc)
|
||||
}
|
||||
|
||||
await manager.persistAndFlush(channels)
|
||||
|
||||
return channels
|
||||
}
|
||||
Reference in New Issue
Block a user