chore(medusa): Typeorm upgrade to 0.3.11 (#3041)

This commit is contained in:
Riqwan Thamir authored and GitHub committed 2023-02-15 16:25:30 +01:00
1 parent 8137061908
commit 121b42acfe
275 files changed
+4493 -4780

No files matched your search

@@ -1,8 +1,8 @@
const Scrypt = require("scrypt-kdf")
const { User } = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const buf = await Scrypt.kdf("secret_password", { logN: 1, r: 1, p: 1 })
const password_hash = buf.toString("base64")
@@ -11,8 +11,8 @@ const {
ProductOption,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const yesterday = ((today) => new Date(today.setDate(today.getDate() - 1)))(
new Date()
@@ -23,7 +23,7 @@ module.exports = async (connection, data = {}) => {
)
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfile.default },
})
const collection = manager.create(ProductCollection, {
@@ -1,7 +1,7 @@
const { Region } = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
await manager.insert(Region, {
id: "region-product-import-0",
+5 -4
View File
@@ -16,9 +16,10 @@ const {
PaymentSession,
CustomerGroup,
PriceList,
ShippingProfileType,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
module.exports = async (dataSource, data = {}) => {
const yesterday = ((today) => new Date(today.setDate(today.getDate() - 1)))(
new Date()
)
@@ -31,14 +32,14 @@ module.exports = async (connection, data = {}) => {
const tenDaysFromToday = ((today) =>
new Date(today.setDate(today.getDate() + 10)))(new Date())
const manager = connection.manager
const manager = dataSource.manager
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfileType.DEFAULT },
})
const gcProfile = await manager.findOne(ShippingProfile, {
type: "gift_card",
where: { type: ShippingProfileType.GIFT_CARD },
})
await manager.insert(Address, {
@@ -6,8 +6,8 @@ const {
Return,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
let orderWithClaim = manager.create(Order, {
id: "order-with-claim",
@@ -1,7 +1,7 @@
const { Customer, Address, CustomerGroup } = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const testAddr = await manager.create(Address, {
id: "test-address",
@@ -4,8 +4,8 @@ const {
Discount,
DiscountRule,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
await manager.insert(Region, {
id: "test-region",
@@ -14,17 +14,18 @@ const {
Discount,
DiscountRule,
Payment,
ShippingProfileType,
} = require("@medusajs/medusa")
const { simpleSalesChannelFactory } = require("../factories")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfileType.DEFAULT },
})
const salesChannel = await simpleSalesChannelFactory(connection, {
const salesChannel = await simpleSalesChannelFactory(dataSource, {
id: "sales-channel",
is_default: true,
})
@@ -13,17 +13,18 @@ const {
ShippingOption,
ShippingProfile,
Swap,
ShippingProfileType,
} = require("@medusajs/medusa")
const { simpleSalesChannelFactory } = require("../factories")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfileType.DEFAULT },
})
const salesChannel = await simpleSalesChannelFactory(connection, {
const salesChannel = await simpleSalesChannelFactory(dataSource, {
id: "test-channel",
is_default: true,
})
@@ -1,7 +1,7 @@
const { Region, PriceList, MoneyAmount } = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const priceListNoCustomerGroups = await manager.create(PriceList, {
id: "pl_no_customer_groups",
@@ -9,9 +9,10 @@ const {
Region,
Cart,
PriceList,
ShippingProfileType,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
module.exports = async (dataSource, data = {}) => {
const yesterday = ((today) => new Date(today.setDate(today.getDate() - 1)))(
new Date()
)
@@ -24,10 +25,10 @@ module.exports = async (connection, data = {}) => {
const tenDaysFromToday = ((today) =>
new Date(today.setDate(today.getDate() + 10)))(new Date())
const manager = connection.manager
const manager = dataSource.manager
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfileType.DEFAULT },
})
await manager.insert(Region, {
@@ -8,14 +8,16 @@ const {
ShippingProfile,
ProductVariant,
Image,
Store,
ShippingProfileType,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: {
type: ShippingProfileType.DEFAULT,
},
})
const coll = await manager.create(ProductCollection, {
@@ -3,10 +3,11 @@ const {
ShippingProfile,
ShippingOption,
ShippingOptionRequirement,
ShippingProfileType,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
await manager.insert(Region, {
id: "region",
@@ -16,7 +17,7 @@ module.exports = async (connection, data = {}) => {
})
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfileType.DEFAULT },
})
await manager.insert(ShippingOption, {
@@ -10,10 +10,11 @@ const {
Image,
Cart,
PriceList,
ShippingProfileType,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const yesterday = ((today) => new Date(today.setDate(today.getDate() - 1)))(
new Date()
@@ -48,7 +49,7 @@ module.exports = async (connection, data = {}) => {
await manager.save(priceList1)
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
where: { type: ShippingProfileType.DEFAULT },
})
const coll = manager.create(ProductCollection, {
+3 -3
View File
@@ -16,12 +16,12 @@ const { Region } = require("@medusajs/medusa/dist/models/region")
let regionId
let region
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
regionId = "test-region"
region = await manager.findOne(Region, { id: regionId })
region = await manager.findOne(Region, { where: { id: regionId } })
let orderWithSwap = manager.create(Order, {
id: "order-with-swap",
+2 -2
View File
@@ -11,8 +11,8 @@ const expires_at = new Date()
expires_at.setDate(expires_at.getDate() + 8)
module.exports = async (connection, data = {}) => {
const manager = connection.manager
module.exports = async (dataSource, data = {}) => {
const manager = dataSource.manager
const memberUser = await manager.create(User, {
id: "member-user",