Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/icy-plums-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/dashboard": patch
"@medusajs/product": patch
---

fix(product, dashboard): align product and variant volumetric attributes data types
24 changes: 10 additions & 14 deletions integration-tests/http/__tests__/product/admin/product.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,6 @@ medusaIntegrationTestRunner({
})

it("should return products filtered by external_id", async () => {

const newProduct = (
await api.post(
"/admin/products",
Expand Down Expand Up @@ -2002,10 +2001,10 @@ medusaIntegrationTestRunner({

expect(updatedProduct).toEqual(
expect.objectContaining({
weight: "20",
weight: 20,
length: null,
width: "100",
height: "100",
width: 100,
height: 100,
})
)

Expand All @@ -2019,10 +2018,10 @@ medusaIntegrationTestRunner({

expect(updatedProduct).toEqual(
expect.objectContaining({
weight: "20",
weight: 20,
length: null,
width: "100",
height: "100",
width: 100,
height: 100,
categories: expect.arrayContaining([
expect.objectContaining({
id: pantsCategory.id,
Expand All @@ -2042,9 +2041,9 @@ medusaIntegrationTestRunner({
expect(updatedProduct).toEqual(
expect.objectContaining({
weight: null,
length: "20",
width: "50",
height: "100",
length: 20,
width: 50,
height: 100,
categories: expect.arrayContaining([
expect.objectContaining({
id: pantsCategory.id,
Expand Down Expand Up @@ -3439,10 +3438,7 @@ medusaIntegrationTestRunner({
// The remaining inventory item should also be deleted since it
// was only associated with this product's variant
const item2Response = await api
.get(
`/admin/inventory-items/${inventoryItem2.id}`,
adminHeaders
)
.get(`/admin/inventory-items/${inventoryItem2.id}`, adminHeaders)
.catch((err) => err.response)

expect(item2Response.status).toEqual(404)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
transformNullableFormData,
transformNullableFormNumber,
} from "../../../../../lib/form-helpers"
import { optionalInt } from "../../../../../lib/validation"
import { optionalFloat } from "../../../../../lib/validation"

type ProductEditVariantFormProps = {
product: HttpTypes.AdminProduct
Expand All @@ -31,10 +31,10 @@ const ProductEditVariantSchema = z.object({
barcode: z.string().optional(),
manage_inventory: z.boolean(),
allow_backorder: z.boolean(),
weight: optionalInt,
height: optionalInt,
width: optionalInt,
length: optionalInt,
weight: optionalFloat,
height: optionalFloat,
width: optionalFloat,
length: optionalFloat,
mid_code: z.string().optional(),
hs_code: z.string().optional(),
origin_country: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const ProductCreateVariantSchema = z.object({
barcode: z.string().optional(),
mid_code: z.string().optional(),
hs_code: z.string().optional(),
width: optionalInt,
height: optionalInt,
length: optionalInt,
weight: optionalInt,
width: optionalFloat,
height: optionalFloat,
length: optionalFloat,
weight: optionalFloat,
material: z.string().optional(),
origin_country: z.string().optional(),
sku: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,10 @@ moduleIntegrationTestRunner<IProductModuleService>({
discountable: productBefore.discountable,
thumbnail: images[0].url,
status: productBefore.status,
// TODO: Notice how the weight/length/height/width are strings, not respecting the ProductDTO typings
weight: "101",
length: "201",
height: "301",
width: "401",
weight: 101,
length: 201,
height: 301,
width: 401,
images: expect.arrayContaining([
expect.objectContaining({
id: expect.any(String),
Expand Down
Loading
Loading