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 15:02:16 +02:00
committed by GitHub
parent 2895ccfba8
commit 48963f55ef
533 changed files with 6469 additions and 9769 deletions

View File

@@ -29,10 +29,10 @@ medusaIntegrationTestRunner({
})
it("should batch add customers to a group", async () => {
const group = await customerModuleService.createCustomerGroup({
const group = await customerModuleService.createCustomerGroups({
name: "VIP",
})
const customers = await customerModuleService.create([
const customers = await customerModuleService.createCustomers([
{
first_name: "Test",
last_name: "Test",

View File

@@ -29,10 +29,10 @@ medusaIntegrationTestRunner({
})
it("should batch delete customers from a group", async () => {
const group = await customerModuleService.createCustomerGroup({
const group = await customerModuleService.createCustomerGroups({
name: "VIP",
})
const customers = await customerModuleService.create([
const customers = await customerModuleService.createCustomers([
{
first_name: "Test",
last_name: "Test",

View File

@@ -1,5 +1,3 @@
import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { createAdminUser } from "../../../../helpers/create-admin-user"
import { medusaIntegrationTestRunner } from "medusa-test-utils"
@@ -15,13 +13,9 @@ medusaIntegrationTestRunner({
testSuite: ({ dbConnection, getContainer, api }) => {
describe("POST /admin/customer-groups", () => {
let appContainer
let customerModuleService: ICustomerModuleService
beforeAll(async () => {
appContainer = getContainer()
customerModuleService = appContainer.resolve(
ModuleRegistrationName.CUSTOMER
)
})
beforeEach(async () => {

View File

@@ -29,7 +29,7 @@ medusaIntegrationTestRunner({
})
it("should delete a group", async () => {
const group = await customerModuleService.createCustomerGroup({
const group = await customerModuleService.createCustomerGroups({
name: "VIP",
})

View File

@@ -29,11 +29,11 @@ medusaIntegrationTestRunner({
})
it("should get all customer groups and its count", async () => {
const group = await customerModuleService.createCustomerGroup({
const group = await customerModuleService.createCustomerGroups({
name: "Test",
})
const customers = await customerModuleService.create([
const customers = await customerModuleService.createCustomers([
{
first_name: "Test",
last_name: "Test",

View File

@@ -29,7 +29,7 @@ medusaIntegrationTestRunner({
})
it("should get all customer groups and its count", async () => {
await customerModuleService.createCustomerGroup({
await customerModuleService.createCustomerGroups({
name: "Test",
})
@@ -46,7 +46,7 @@ medusaIntegrationTestRunner({
})
it("should support searching of customer groups", async () => {
await customerModuleService.createCustomerGroup([
await customerModuleService.createCustomerGroups([
{
name: "First group",
},

View File

@@ -29,7 +29,7 @@ medusaIntegrationTestRunner({
})
it("should retrieve customer group", async () => {
const group = await customerModuleService.createCustomerGroup({
const group = await customerModuleService.createCustomerGroups({
name: "Test",
})

View File

@@ -29,7 +29,7 @@ medusaIntegrationTestRunner({
})
it("should update a customer group", async () => {
const customer = await customerModuleService.createCustomerGroup({
const customer = await customerModuleService.createCustomerGroups({
name: "VIP",
})