fix(medusa, types): Mark properties as nullable to reflect their correct types (#5281)

* fix(medusa, types): Mark properties as nullable to reflect their correct types

* Create chilly-pugs-doubt.md

* fix column type to prevent inference

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2023-10-15 18:10:36 +02:00
1 parent 3376f4ccc1
commit 69cf7215f1
3 files changed
+41 -35

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@medusajs/medusa": patch
"@medusajs/types": patch
---
fix(medusa, types): Mark properties as nullable to reflect their correct types
+23 -23
View File
@@ -46,24 +46,24 @@ export class ProductVariant extends SoftDeletableEntity {
}) })
prices: MoneyAmount[] prices: MoneyAmount[]
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
@Index({ unique: true, where: "deleted_at IS NULL" }) @Index({ unique: true, where: "deleted_at IS NULL" })
sku: string sku: string | null
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
@Index({ unique: true, where: "deleted_at IS NULL" }) @Index({ unique: true, where: "deleted_at IS NULL" })
barcode: string barcode: string | null
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
@Index({ unique: true, where: "deleted_at IS NULL" }) @Index({ unique: true, where: "deleted_at IS NULL" })
ean: string ean: string | null
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
@Index({ unique: true, where: "deleted_at IS NULL" }) @Index({ unique: true, where: "deleted_at IS NULL" })
upc: string upc: string | null
@Column({ nullable: true, default: 0 }) @Column({ nullable: true, type: "text", default: 0 })
variant_rank: number variant_rank: number | null
@Column({ type: "int" }) @Column({ type: "int" })
inventory_quantity: number inventory_quantity: number
@@ -74,29 +74,29 @@ export class ProductVariant extends SoftDeletableEntity {
@Column({ default: true }) @Column({ default: true })
manage_inventory: boolean manage_inventory: boolean
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
hs_code: string hs_code: string | null
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
origin_country: string origin_country: string | null
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
mid_code: string mid_code: string | null
@Column({ nullable: true }) @Column({ nullable: true, type: "text" })
material: string material: string | null
@Column({ type: "int", nullable: true }) @Column({ type: "int", nullable: true })
weight: number weight: number | null
@Column({ type: "int", nullable: true }) @Column({ type: "int", nullable: true })
length: number length: number | null
@Column({ type: "int", nullable: true }) @Column({ type: "int", nullable: true })
height: number height: number | null
@Column({ type: "int", nullable: true }) @Column({ type: "int", nullable: true })
width: number width: number | null
@OneToMany(() => ProductOptionValue, (optionValue) => optionValue.variant, { @OneToMany(() => ProductOptionValue, (optionValue) => optionValue.variant, {
cascade: true, cascade: true,
@@ -113,7 +113,7 @@ export class ProductVariant extends SoftDeletableEntity {
inventory_items: ProductVariantInventoryItem[] inventory_items: ProductVariantInventoryItem[]
@DbAwareColumn({ type: "jsonb", nullable: true }) @DbAwareColumn({ type: "jsonb", nullable: true })
metadata: Record<string, unknown> metadata: Record<string, unknown> | null
purchasable?: boolean purchasable?: boolean
+12 -12
View File
@@ -220,19 +220,19 @@ export type FilterableInventoryItemProps = {
} }
export type CreateInventoryItemInput = { export type CreateInventoryItemInput = {
sku?: string sku?: string | null
origin_country?: string origin_country?: string | null
mid_code?: string mid_code?: string | null
material?: string material?: string | null
weight?: number weight?: number | null
length?: number length?: number | null
height?: number height?: number | null
width?: number width?: number | null
title?: string title?: string | null
description?: string description?: string | null
thumbnail?: string thumbnail?: string | null
metadata?: Record<string, unknown> | null metadata?: Record<string, unknown> | null
hs_code?: string hs_code?: string | null
requires_shipping?: boolean requires_shipping?: boolean
} }