Chore/rm main entity concept (#7709)

**What**
Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate.
This pr also includes various fixes in different modules

Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2024-06-19 13:02:16 +00:00
1 parent 2895ccfba8
commit 48963f55ef
533 files changed
+6469 -9769

No files matched your search

@@ -22,14 +22,14 @@ async function createProductsWithVariants(
): Promise<[ProductDTO, ProductVariantDTO[]]> {
const { variants: variantsData, ...productData } = productsData
const [product] = await productModule.create([productData])
const [product] = await productModule.createProducts([productData])
const variantsDataWithProductId = variantsData?.map((variantData) => {
return { ...variantData, product_id: product.id }
})
const variants = variantsDataWithProductId
? await productModule.createVariants(variantsDataWithProductId)
? await productModule.createProductVariants(variantsDataWithProductId)
: []
return [product, variants]
@@ -35,8 +35,8 @@ medusaIntegrationTestRunner({
},
})
const product1 = await service.create({ title: "test1" })
const product2 = await service.create({ title: "test2" })
const product1 = await service.createProducts({ title: "test1" })
const product2 = await service.createProducts({ title: "test2" })
const { errors } = await workflow.run({
input: {
@@ -57,7 +57,7 @@ medusaIntegrationTestRunner({
},
])
const products = await service.list()
const products = await service.listProducts()
expect(products).toHaveLength(2)
expect(products).toEqual([
@@ -135,7 +135,7 @@ medusaIntegrationTestRunner({
},
])
const product = await service.retrieve(product1.id, {
const product = await service.retrieveProduct(product1.id, {
relations: ["variants"],
})