feat(products,types,pricing): allow scoping products by collection_id + pricing by currency_code (#4965)

* chore: allow scoping products by collection_id

* chore: scope money amounts by currency code + change category_ids to category_id

* chore: add an extra product to test without collection

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Riqwan ThamirandOli Juhl authored and GitHub committed 2023-09-07 09:06:50 +02:00
1 parent b71776738c
commit 66bd9a835c
11 files changed
+438 -140

No files matched your search

@@ -1,6 +1,6 @@
import { ProductTypes } from "@medusajs/types"
import faker from "faker"
import { Image } from "@models"
import faker from "faker"
export const buildProductOnlyData = ({
title,
@@ -46,6 +46,7 @@ export const buildProductAndRelationsData = ({
tags,
options,
variants,
collection_id,
}: Partial<ProductTypes.CreateProductDTO>) => {
const defaultOptionTitle = faker.commerce.productName()
return {
@@ -59,6 +60,7 @@ export const buildProductAndRelationsData = ({
images: (images ?? []) as Image[],
type: type ? { value: type } : { value: faker.commerce.productName() },
tags: tags ?? [{ value: "tag-1" }],
collection_id,
options: options ?? [
{
title: defaultOptionTitle,
@@ -23,6 +23,17 @@ export const productsData = [
},
],
},
{
id: "test-3",
title: "product 3",
status: ProductTypes.ProductStatus.PUBLISHED,
tags: [
{
id: "tag-3",
value: "Germany",
},
],
},
]
export const variantsData = [
@@ -20,6 +20,7 @@ export async function createProductAndTags(
title: string
status: ProductTypes.ProductStatus
tags?: { id: string; value: string }[]
collection_id?: string
}[]
) {
const products: any[] = data.map((productData) => {