chore: Remove typeORM (#9005)

* chore: rename js files to txt

* chore: rename ts files to txt

* chore: delete environment helpers

* chore: convert global setup & teardown to txt

* chore: rename helper js/ts files to txt

* chore: rename seeder js/ts files to txt

* chore: remove typeorm

* chore: reintroduce used helpers
This commit is contained in:
Riqwan Thamir authored and GitHub committed 2024-09-05 15:45:30 +02:00
1 parent 440f598de8
commit 0573bb924a
124 files changed
+80 -1386

No files matched your search

@@ -0,0 +1,34 @@
import { DataSource } from "typeorm"
import faker from "faker"
import { Address } from "@medusajs/medusa"
export type AddressFactoryData = {
first_name?: string
last_name?: string
country_code?: string
address_1?: string
postal_code?: string
}
export const simpleAddressFactory = async (
dataSource: DataSource,
data: AddressFactoryData = {},
seed?: number
): Promise<Address> => {
if (typeof seed !== "undefined") {
faker.seed(seed)
}
const manager = dataSource.manager
const address = manager.create(Address, {
id: `simple-id-${Math.random() * 1000}`,
first_name: data.first_name || faker.name.firstName(),
last_name: data.last_name || faker.name.lastName(),
country_code: data.country_code || "us",
address_1: data.address_1 || faker.address.streetAddress(),
postal_code: data.postal_code || faker.address.zipCode(),
})
return await manager.save(address)
}