feat(customer): add customer group management apis (#6233)

**What**
```
POST /admin/customer-groups
POST /admin/customer-groups/:id
GET /admin/customer-groups/:id
DELETE /admin/customer-groups/:id
```

- Workflows
This commit is contained in:
Sebastian Rindom
2024-01-30 19:37:53 +00:00
committed by GitHub
parent 8c7a031090
commit ca0e0631af
20 changed files with 540 additions and 20 deletions
@@ -19,11 +19,7 @@ import {
isString,
isObject,
} from "@medusajs/utils"
import {
entityNameToLinkableKeysMap,
LinkableKeys,
joinerConfig,
} from "../joiner-config"
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
import * as services from "../services"
type InjectedDependencies = {
@@ -111,24 +107,24 @@ export default class CustomerModuleService implements ICustomerModuleService {
update(
customerId: string,
data: CustomerUpdatableFields,
data: CustomerTypes.CustomerUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerDTO>
update(
customerIds: string[],
data: CustomerUpdatableFields,
data: CustomerTypes.CustomerUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerDTO[]>
update(
selector: CustomerTypes.FilterableCustomerProps,
data: CustomerUpdatableFields,
data: CustomerTypes.CustomerUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerDTO[]>
@InjectTransactionManager("baseRepository_")
async update(
idsOrSelector: string | string[] | CustomerTypes.FilterableCustomerProps,
data: CustomerUpdatableFields,
data: CustomerTypes.CustomerUpdatableFields,
@MedusaContext() sharedContext: Context = {}
) {
let updateData: CustomerTypes.UpdateCustomerDTO[] = []
@@ -291,17 +287,17 @@ export default class CustomerModuleService implements ICustomerModuleService {
async updateCustomerGroup(
groupId: string,
data: Partial<CustomerTypes.CreateCustomerGroupDTO>,
data: CustomerTypes.CustomerGroupUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO>
async updateCustomerGroup(
groupIds: string[],
data: Partial<CustomerTypes.CreateCustomerGroupDTO>,
data: CustomerTypes.CustomerGroupUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO[]>
async updateCustomerGroup(
selector: CustomerTypes.FilterableCustomerGroupProps,
data: Partial<CustomerTypes.CreateCustomerGroupDTO>,
data: CustomerTypes.CustomerGroupUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO[]>
@@ -311,7 +307,7 @@ export default class CustomerModuleService implements ICustomerModuleService {
| string
| string[]
| CustomerTypes.FilterableCustomerGroupProps,
data: Partial<CustomerTypes.CreateCustomerGroupDTO>,
data: CustomerTypes.CustomerGroupUpdatableFields,
@MedusaContext() sharedContext: Context = {}
) {
let updateData: CustomerTypes.UpdateCustomerGroupDTO[] = []