chore(): Reorganize modules (#7210)

**What**
Move all modules to the modules directory
This commit is contained in:
Adrien de Peretti
2024-05-02 15:33:34 +00:00
committed by GitHub
parent 7a351eef09
commit 4eae25e1ef
870 changed files with 91 additions and 62 deletions
@@ -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
}