feat(medusa): Separate money amount and variant (#4906)

* initial changes

* working test

* final changes to product tests

* update integration tests

* update price list integration tests

* update integration tests

* update unit tests

* update plugin integration tests

* remove catch from integration test

* undo change

* add andWhere

* update upsertCurrencyMoneyAmount method

* undo line item changes

* undo changes

* update deprecated method

* Update packages/medusa/src/migrations/1692953518123-drop_money_amount_constraints_for_pricing_module.ts

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* rename joinTable

* update with joinTable entity

* update load methods

* remove await create

* re-add context test

* update price list behavior for prices

* update price list snapshots

* re-add admin seeder

* pr feedback

* fix unit tests

* fix plugin integration tests

* initial review changes

* redo changes to variant creation

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Philip Korsholm
2023-09-13 13:26:20 +02:00
committed by GitHub
parent 3d68be2b6b
commit 5d10c46bb1
52 changed files with 2465 additions and 910 deletions

View File

@@ -6,6 +6,7 @@ import setupServer from "../../../../environment-helpers/setup-server"
import { setPort, useApi } from "../../../../environment-helpers/use-api"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import { simpleProductFactory } from "../../../../factories"
import { ProductVariantMoneyAmount } from "@medusajs/medusa"
jest.setTimeout(30000)
@@ -125,7 +126,6 @@ describe("/store/carts", () => {
await dbConnection.manager.save(priceList1)
const ma_sale_1 = dbConnection.manager.create(MoneyAmount, {
variant_id: prodSale.variants[0].id,
currency_code: "usd",
amount: 800,
price_list_id: "pl_current",
@@ -133,6 +133,12 @@ describe("/store/carts", () => {
await dbConnection.manager.save(ma_sale_1)
await dbConnection.manager.insert(ProductVariantMoneyAmount, {
id: 'pvma-test',
variant_id: prodSale.variants[0].id,
money_amount_id: ma_sale_1.id,
})
const api = useApi()
const response = await api