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:
co-authored by
Stevche Radevski
Oli Juhl
parent
2895ccfba8
commit
48963f55ef
@@ -47,7 +47,7 @@ medusaIntegrationTestRunner({
|
||||
beforeEach(async () => {
|
||||
await createAdminUser(dbConnection, adminHeaders, appContainer)
|
||||
|
||||
standardPromotion = await promotionModule.create({
|
||||
standardPromotion = await promotionModule.createPromotions({
|
||||
code: "TEST_ACROSS",
|
||||
type: PromotionType.STANDARD,
|
||||
application_method: {
|
||||
@@ -322,7 +322,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("should add buy rules to a buyget promotion successfully", async () => {
|
||||
const buyGetPromotion = await promotionModule.create({
|
||||
const buyGetPromotion = await promotionModule.createPromotions({
|
||||
code: "TEST_BUYGET",
|
||||
type: PromotionType.BUYGET,
|
||||
application_method: {
|
||||
@@ -414,7 +414,7 @@ medusaIntegrationTestRunner({
|
||||
deleted: true,
|
||||
})
|
||||
|
||||
const promotion = await promotionModule.retrieve(
|
||||
const promotion = await promotionModule.retrievePromotion(
|
||||
standardPromotion.id,
|
||||
{ relations: ["rules"] }
|
||||
)
|
||||
@@ -455,7 +455,7 @@ medusaIntegrationTestRunner({
|
||||
deleted: true,
|
||||
})
|
||||
|
||||
const promotion = await promotionModule.retrieve(
|
||||
const promotion = await promotionModule.retrievePromotion(
|
||||
standardPromotion.id,
|
||||
{ relations: ["application_method.target_rules"] }
|
||||
)
|
||||
@@ -482,7 +482,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("should remove buy rules from a promotion successfully", async () => {
|
||||
const buyGetPromotion = await promotionModule.create({
|
||||
const buyGetPromotion = await promotionModule.createPromotions({
|
||||
code: "TEST_BUYGET",
|
||||
type: PromotionType.BUYGET,
|
||||
application_method: {
|
||||
@@ -513,9 +513,12 @@ medusaIntegrationTestRunner({
|
||||
deleted: true,
|
||||
})
|
||||
|
||||
const promotion = await promotionModule.retrieve(buyGetPromotion.id, {
|
||||
relations: ["application_method.buy_rules"],
|
||||
})
|
||||
const promotion = await promotionModule.retrievePromotion(
|
||||
buyGetPromotion.id,
|
||||
{
|
||||
relations: ["application_method.buy_rules"],
|
||||
}
|
||||
)
|
||||
|
||||
expect(promotion.application_method!.buy_rules!.length).toEqual(0)
|
||||
})
|
||||
@@ -731,7 +734,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("should return all values based on rule types", async () => {
|
||||
const [region1, region2] = await regionService.create([
|
||||
const [region1, region2] = await regionService.createRegions([
|
||||
{ name: "North America", currency_code: "usd" },
|
||||
{ name: "Europe", currency_code: "eur" },
|
||||
])
|
||||
@@ -770,7 +773,7 @@ medusaIntegrationTestRunner({
|
||||
])
|
||||
)
|
||||
|
||||
const group = await customerService.createCustomerGroup({
|
||||
const group = await customerService.createCustomerGroups({
|
||||
name: "VIP",
|
||||
})
|
||||
|
||||
@@ -787,7 +790,7 @@ medusaIntegrationTestRunner({
|
||||
},
|
||||
])
|
||||
|
||||
const salesChannel = await salesChannelService.create({
|
||||
const salesChannel = await salesChannelService.createSalesChannels({
|
||||
name: "Instagram",
|
||||
})
|
||||
|
||||
@@ -826,7 +829,7 @@ medusaIntegrationTestRunner({
|
||||
])
|
||||
)
|
||||
|
||||
const [product1, product2] = await productService.create([
|
||||
const [product1, product2] = await productService.createProducts([
|
||||
{ title: "test product 1" },
|
||||
{ title: "test product 2" },
|
||||
])
|
||||
@@ -845,7 +848,7 @@ medusaIntegrationTestRunner({
|
||||
])
|
||||
)
|
||||
|
||||
const category = await productService.createCategory({
|
||||
const category = await productService.createProductCategories({
|
||||
name: "test category 1",
|
||||
parent_category_id: null,
|
||||
})
|
||||
@@ -860,7 +863,7 @@ medusaIntegrationTestRunner({
|
||||
{ label: "test category 1", value: category.id },
|
||||
])
|
||||
|
||||
const collection = await productService.createCollections({
|
||||
const collection = await productService.createProductCollections({
|
||||
title: "test collection 1",
|
||||
})
|
||||
|
||||
@@ -874,7 +877,7 @@ medusaIntegrationTestRunner({
|
||||
{ label: "test collection 1", value: collection.id },
|
||||
])
|
||||
|
||||
const type = await productService.createTypes({
|
||||
const type = await productService.createProductTypes({
|
||||
value: "test type",
|
||||
})
|
||||
|
||||
@@ -888,7 +891,7 @@ medusaIntegrationTestRunner({
|
||||
{ label: "test type", value: type.id },
|
||||
])
|
||||
|
||||
const [tag1, tag2] = await productService.createTags([
|
||||
const [tag1, tag2] = await productService.createProductTags([
|
||||
{ value: "test tag 1" },
|
||||
{ value: "test tag 2" },
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user