chore(medusa): Typeorm upgrade to 0.3.11 (#3041)
This commit is contained in:
@@ -1,17 +1,8 @@
|
||||
import { Connection } from "typeorm"
|
||||
import faker from "faker"
|
||||
import {
|
||||
ShippingProfileType,
|
||||
ShippingProfile,
|
||||
Product,
|
||||
ProductType,
|
||||
ProductOption,
|
||||
} from "@medusajs/medusa"
|
||||
import { Product, ProductOption, ProductType, ShippingProfile, ShippingProfileType, } from "@medusajs/medusa"
|
||||
|
||||
import {
|
||||
simpleProductVariantFactory,
|
||||
ProductVariantFactoryData,
|
||||
} from "./simple-product-variant-factory"
|
||||
import { ProductVariantFactoryData, simpleProductVariantFactory, } from "./simple-product-variant-factory"
|
||||
|
||||
export type ProductFactoryData = {
|
||||
id?: string
|
||||
@@ -34,11 +25,11 @@ export const simpleProductFactory = async (
|
||||
const manager = connection.manager
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
where: { type: ShippingProfileType.DEFAULT },
|
||||
})
|
||||
|
||||
const gcProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.GIFT_CARD,
|
||||
where: { type: ShippingProfileType.GIFT_CARD },
|
||||
})
|
||||
|
||||
let typeId: string
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { Connection } from "typeorm"
|
||||
import faker from "faker"
|
||||
import {
|
||||
ShippingOptionPriceType,
|
||||
ShippingProfile,
|
||||
ShippingOption,
|
||||
ShippingProfileType,
|
||||
} from "@medusajs/medusa"
|
||||
import { ShippingOption, ShippingOptionPriceType, ShippingProfile, ShippingProfileType, } from "@medusajs/medusa"
|
||||
|
||||
export type ShippingOptionFactoryData = {
|
||||
name?: string
|
||||
@@ -26,11 +21,11 @@ export const simpleShippingOptionFactory = async (
|
||||
|
||||
const manager = connection.manager
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
where: { type: ShippingProfileType.DEFAULT },
|
||||
})
|
||||
|
||||
const gcProfile = await manager.findOne(ShippingProfile, {
|
||||
type: ShippingProfileType.GIFT_CARD,
|
||||
where: { type: ShippingProfileType.GIFT_CARD },
|
||||
})
|
||||
|
||||
const created = manager.create(ShippingOption, {
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
import { SalesChannel, Store } from "@medusajs/medusa"
|
||||
import faker from "faker"
|
||||
import { Connection } from "typeorm"
|
||||
import { DataSource, Not, IsNull } from "typeorm"
|
||||
|
||||
export type StoreFactoryData = {
|
||||
swap_link_template?: string
|
||||
}
|
||||
|
||||
export const simpleStoreFactory = async (
|
||||
connection: Connection,
|
||||
dataSource: DataSource,
|
||||
data: StoreFactoryData = {},
|
||||
seed?: number
|
||||
): Promise<Store> => {
|
||||
): Promise<Store | undefined> => {
|
||||
if (typeof seed !== "undefined") {
|
||||
faker.seed(seed)
|
||||
}
|
||||
|
||||
const manager = connection.manager
|
||||
const store = await manager.findOne(Store)
|
||||
const manager = dataSource.manager
|
||||
const stores = await manager.find(Store, { where: { id: Not(IsNull()) } })
|
||||
const store = stores[0]
|
||||
|
||||
if (!store) {
|
||||
return
|
||||
}
|
||||
|
||||
store.swap_link_template = data.swap_link_template ?? "something/{cart_id}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user