refactor: migrate pricing entities to DML models (#10335)
Fixes: FRMW-2810 ## Breaking changes There is only one breaking change - The `min_quantity` and `max_quantity` properties are now consistently typed as numbers. Earlier, it was [typed as numbers](https://github.com/medusajs/medusa/blob/develop/integration-tests/http/__tests__/price-list/admin/price-list.spec.ts#L68-L69) in some API responses and as [string in others](https://github.com/medusajs/medusa/blob/develop/integration-tests/http/__tests__/price-list/admin/price-list.spec.ts#L186-L187). I did not go to the bottom of this inconsistency, but the tests reveals them. Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
co-authored by
Adrien de Peretti
parent
b4d6a4b3f0
commit
913cf15e2b
@@ -183,8 +183,8 @@ medusaIntegrationTestRunner({
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
// BREAKING: Min and max quantity are returned as string
|
||||
min_quantity: "1",
|
||||
max_quantity: "100",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: product1.variants[0].id,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
@@ -194,8 +194,8 @@ medusaIntegrationTestRunner({
|
||||
id: expect.any(String),
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: "101",
|
||||
max_quantity: "500",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: product1.variants[0].id,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
@@ -360,15 +360,15 @@ medusaIntegrationTestRunner({
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
id: expect.any(String),
|
||||
max_quantity: "100",
|
||||
min_quantity: "1",
|
||||
max_quantity: 100,
|
||||
min_quantity: 1,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
id: expect.any(String),
|
||||
max_quantity: "500",
|
||||
min_quantity: "101",
|
||||
max_quantity: 500,
|
||||
min_quantity: 101,
|
||||
}),
|
||||
]),
|
||||
rules: {
|
||||
@@ -409,15 +409,15 @@ medusaIntegrationTestRunner({
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
id: expect.any(String),
|
||||
max_quantity: "100",
|
||||
min_quantity: "1",
|
||||
max_quantity: 100,
|
||||
min_quantity: 1,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: 250,
|
||||
currency_code: "eur",
|
||||
id: expect.any(String),
|
||||
max_quantity: "500",
|
||||
min_quantity: "101",
|
||||
max_quantity: 500,
|
||||
min_quantity: 101,
|
||||
}),
|
||||
])
|
||||
})
|
||||
@@ -470,16 +470,16 @@ medusaIntegrationTestRunner({
|
||||
id: expect.any(String),
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: "1",
|
||||
max_quantity: "100",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: "101",
|
||||
max_quantity: "500",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
@@ -487,24 +487,24 @@ medusaIntegrationTestRunner({
|
||||
amount: 45,
|
||||
currency_code: "usd",
|
||||
variant_id: product1.variants[0].id,
|
||||
min_quantity: "1001",
|
||||
max_quantity: "2000",
|
||||
min_quantity: 1001,
|
||||
max_quantity: 2000,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
amount: 35,
|
||||
currency_code: "usd",
|
||||
variant_id: product1.variants[0].id,
|
||||
min_quantity: "2001",
|
||||
max_quantity: "3000",
|
||||
min_quantity: 2001,
|
||||
max_quantity: 3000,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
amount: 25,
|
||||
currency_code: "usd",
|
||||
variant_id: product1.variants[0].id,
|
||||
min_quantity: "3001",
|
||||
max_quantity: "4000",
|
||||
min_quantity: 3001,
|
||||
max_quantity: 4000,
|
||||
}),
|
||||
])
|
||||
)
|
||||
@@ -551,16 +551,16 @@ medusaIntegrationTestRunner({
|
||||
id: expect.any(String),
|
||||
amount: 45,
|
||||
currency_code: "usd",
|
||||
min_quantity: "1",
|
||||
max_quantity: "100",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
amount: 35,
|
||||
currency_code: "usd",
|
||||
min_quantity: "101",
|
||||
max_quantity: "500",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
])
|
||||
@@ -605,16 +605,16 @@ medusaIntegrationTestRunner({
|
||||
id: expect.any(String),
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: "1",
|
||||
max_quantity: "100",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: "101",
|
||||
max_quantity: "500",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
@@ -698,8 +698,8 @@ medusaIntegrationTestRunner({
|
||||
expect.objectContaining({
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: "101",
|
||||
max_quantity: "500",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: product1.variants[0].id,
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -191,6 +191,7 @@ medusaIntegrationTestRunner({
|
||||
max_quantity: null,
|
||||
min_quantity: null,
|
||||
price_list: null,
|
||||
price_list_id: null,
|
||||
price_set_id: expect.any(String),
|
||||
raw_amount: {
|
||||
precision: 20,
|
||||
@@ -210,6 +211,7 @@ medusaIntegrationTestRunner({
|
||||
max_quantity: null,
|
||||
min_quantity: null,
|
||||
price_list: null,
|
||||
price_list_id: null,
|
||||
price_set_id: expect.any(String),
|
||||
raw_amount: {
|
||||
precision: 20,
|
||||
|
||||
Reference in New Issue
Block a user