What: Renames pricesetmoneyamount to prices Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
22 lines
480 B
TypeScript
22 lines
480 B
TypeScript
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
|
|
}
|