chore(): Reorganize modules (#7210)
**What** Move all modules to the modules directory
This commit is contained in:
committed by
GitHub
parent
7a351eef09
commit
4eae25e1ef
@@ -0,0 +1,23 @@
|
||||
export const defaultCartsData = [
|
||||
{
|
||||
id: "cart-id-1",
|
||||
region_id: "region-id-1",
|
||||
customer_id: "customer-id-1",
|
||||
email: "test@email.com",
|
||||
currency_code: "usd",
|
||||
},
|
||||
{
|
||||
id: "cart-id-2",
|
||||
region_id: "region-id-1",
|
||||
customer_id: "customer-id-1",
|
||||
shipping_address: {
|
||||
first_name: "Tony",
|
||||
last_name: "Stark",
|
||||
},
|
||||
billing_address: {
|
||||
address_1: "Stark Industries",
|
||||
city: "New York",
|
||||
},
|
||||
currency_code: "usd",
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
import { CreateCartDTO } from "@medusajs/types"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { Cart } from "../../../src/models"
|
||||
import { defaultCartsData } from "./data"
|
||||
|
||||
export * from "./data"
|
||||
|
||||
export async function createCarts(
|
||||
manager: SqlEntityManager,
|
||||
cartsData: CreateCartDTO[] = defaultCartsData
|
||||
): Promise<Cart[]> {
|
||||
const carts: Cart[] = []
|
||||
|
||||
for (let cartData of cartsData) {
|
||||
let cart = manager.create(Cart, cartData)
|
||||
|
||||
await manager.persistAndFlush(cart)
|
||||
}
|
||||
|
||||
return carts
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user