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:
Adrien de Peretti
2024-06-19 13:02:16 +00:00
committed by GitHub
co-authored by Stevche Radevski Oli Juhl
parent 2895ccfba8
commit 48963f55ef
533 changed files with 6469 additions and 9769 deletions
@@ -13,16 +13,20 @@ export const createAuthenticatedCustomer = async (
ModuleRegistrationName.CUSTOMER
)
const customer = await customerModuleService.create({
const customer = await customerModuleService.createCustomers({
first_name: "John",
last_name: "Doe",
email: "john@me.com",
...customerData,
})
const authIdentity = await authService.create({
entity_id: "store_user",
provider: "emailpass",
const authIdentity = await authService.createAuthIdentities({
provider_identities: [
{
entity_id: "store_user",
provider: "emailpass",
},
],
app_metadata: {
customer_id: customer.id,
},
@@ -5,7 +5,7 @@ export const createDefaultRuleTypes = async (container) => {
"pricingModuleService"
)
return pricingModuleService.createRuleTypes([
return await pricingModuleService.createRuleTypes([
{
name: "region_id",
rule_attribute: "region_id",
@@ -30,7 +30,7 @@ export const createVariantPriceSet = async ({
"pricingModuleService"
)
const priceSet = await pricingModuleService.create({
const priceSet = await pricingModuleService.createPriceSets({
rules,
prices,
})
@@ -40,7 +40,7 @@ export const createVariantPriceSet = async ({
[Modules.PRICING]: { price_set_id: priceSet.id },
})
return await pricingModuleService.retrieve(priceSet.id, {
return await pricingModuleService.retrievePriceSet(priceSet.id, {
relations: ["prices"],
})
}