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,26 @@
export const defaultPricesData = [
{
id: "price-set-money-amount-USD",
currency_code: "USD",
amount: 500,
title: "price set money amount USD",
price_set_id: "price-set-1",
rules_count: 1,
},
{
id: "price-set-money-amount-EUR",
currency_code: "EUR",
amount: 400,
title: "price set money amount EUR",
price_set_id: "price-set-2",
rules_count: 1,
},
{
id: "price-set-money-amount-CAD",
currency_code: "CAD",
amount: 600,
title: "price set money amount CAD",
price_set_id: "price-set-3",
rules_count: 1,
},
]
@@ -0,0 +1,21 @@
import { SqlEntityManager } from "@mikro-orm/postgresql"
import { Price } from "@models"
import { defaultPricesData } from "./data"
export * from "./data"
export async function createPrices(
manager: SqlEntityManager,
pricesData: any[] = defaultPricesData
): Promise<Price[]> {
const prices: Price[] = []
for (let data of pricesData) {
const price = manager.create(Price, data)
prices.push(price)
}
await manager.persistAndFlush(prices)
return prices
}