Feat(medusa-test-utils, utils, pricing, product, link-modules): upgrade mikro orm version to latest (#5985)

* update mikro-orm version

* add changeset

* update product tests

* add optional number serializer util

* upgrade cart mikro-orm versions

* clean up test
This commit is contained in:
Philip Korsholm
2024-01-02 17:11:55 +01:00
committed by GitHub
parent 925feea04a
commit d16d10619d
15 changed files with 181 additions and 131 deletions
+16 -3
View File
@@ -1,4 +1,8 @@
import { DALUtils, generateEntityId } from "@medusajs/utils"
import {
DALUtils,
generateEntityId,
optionalNumericSerializer,
} from "@medusajs/utils"
import {
BeforeCreate,
Cascade,
@@ -66,7 +70,11 @@ class ProductVariant {
// Note: Upon serialization, this turns to a string. This is on purpose, because you would loose
// precision if you cast numeric to JS number, as JS number is a float.
// Ref: https://github.com/mikro-orm/mikro-orm/issues/2295
@Property({ columnType: "numeric", default: 100 })
@Property({
columnType: "numeric",
default: 100,
serializer: optionalNumericSerializer,
})
inventory_quantity?: number = 100
@Property({ columnType: "boolean", default: false })
@@ -102,7 +110,12 @@ class ProductVariant {
@Property({ columnType: "jsonb", nullable: true })
metadata?: Record<string, unknown> | null
@Property({ columnType: "numeric", nullable: true, default: 0 })
@Property({
columnType: "numeric",
nullable: true,
default: 0,
serializer: optionalNumericSerializer,
})
variant_rank?: number | null
@Property({ columnType: "text", nullable: true })