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:
Adrien de Peretti
2023-10-15 18:10:36 +02:00
committed by GitHub
parent 3376f4ccc1
commit 69cf7215f1
3 changed files with 42 additions and 36 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/medusa": patch
"@medusajs/types": patch
---
fix(medusa, types): Mark properties as nullable to reflect their correct types

View File

@@ -46,24 +46,24 @@ export class ProductVariant extends SoftDeletableEntity {
})
prices: MoneyAmount[]
@Column({ nullable: true })
@Column({ nullable: true, type: "text" })
@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" })
barcode: string
barcode: string | null
@Column({ nullable: true })
@Column({ nullable: true, type: "text" })
@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" })
upc: string
upc: string | null
@Column({ nullable: true, default: 0 })
variant_rank: number
@Column({ nullable: true, type: "text", default: 0 })
variant_rank: number | null
@Column({ type: "int" })
inventory_quantity: number
@@ -74,29 +74,29 @@ export class ProductVariant extends SoftDeletableEntity {
@Column({ default: true })
manage_inventory: boolean
@Column({ nullable: true })
hs_code: string
@Column({ nullable: true, type: "text" })
hs_code: string | null
@Column({ nullable: true })
origin_country: string
@Column({ nullable: true, type: "text" })
origin_country: string | null
@Column({ nullable: true })
mid_code: string
@Column({ nullable: true, type: "text" })
mid_code: string | null
@Column({ nullable: true })
material: string
@Column({ nullable: true, type: "text" })
material: string | null
@Column({ type: "int", nullable: true })
weight: number
weight: number | null
@Column({ type: "int", nullable: true })
length: number
length: number | null
@Column({ type: "int", nullable: true })
height: number
height: number | null
@Column({ type: "int", nullable: true })
width: number
width: number | null
@OneToMany(() => ProductOptionValue, (optionValue) => optionValue.variant, {
cascade: true,
@@ -113,7 +113,7 @@ export class ProductVariant extends SoftDeletableEntity {
inventory_items: ProductVariantInventoryItem[]
@DbAwareColumn({ type: "jsonb", nullable: true })
metadata: Record<string, unknown>
metadata: Record<string, unknown> | null
purchasable?: boolean

View File

@@ -220,19 +220,19 @@ export type FilterableInventoryItemProps = {
}
export type CreateInventoryItemInput = {
sku?: string
origin_country?: string
mid_code?: string
material?: string
weight?: number
length?: number
height?: number
width?: number
title?: string
description?: string
thumbnail?: string
sku?: string | null
origin_country?: string | null
mid_code?: string | null
material?: string | null
weight?: number | null
length?: number | null
height?: number | null
width?: number | null
title?: string | null
description?: string | null
thumbnail?: string | null
metadata?: Record<string, unknown> | null
hs_code?: string
hs_code?: string | null
requires_shipping?: boolean
}
@@ -242,7 +242,7 @@ export type CreateReservationItemInput = {
location_id: string
quantity: number
description?: string
created_by?: string
created_by?: string
external_id?: string
metadata?: Record<string, unknown> | null
}