feat(customer): add softdelete/restore (#6203)

This commit is contained in:
Sebastian Rindom authored and GitHub committed 2024-01-25 12:38:02 +00:00
1 parent e84847be36
commit e9435a8680
8 files changed
+519 -21

No files matched your search

@@ -418,6 +418,91 @@ describe("Customer Module Service", () => {
const remainingCustomers = await service.list({ last_name: "Doe" }) const remainingCustomers = await service.list({ last_name: "Doe" })
expect(remainingCustomers.length).toBe(0) expect(remainingCustomers.length).toBe(0)
}) })
it("should cascade relationship when deleting customer", async () => {
// Creating a customer and a group
const customer = await service.create({
first_name: "John",
last_name: "Doe",
})
const group = await service.createCustomerGroup({ name: "VIP" })
// Adding the customer to the groups
await service.addCustomerToGroup({
customer_id: customer.id,
customer_group_id: group.id,
})
await service.delete(customer.id)
const res = await service.listCustomerGroupRelations({
customer_id: customer.id,
customer_group_id: group.id,
})
expect(res.length).toBe(0)
})
})
describe("deleteCustomerGroup", () => {
it("should delete a single customer group", async () => {
const [group] = await service.createCustomerGroup([{ name: "VIP" }])
await service.deleteCustomerGroup(group.id)
await expect(
service.retrieveCustomerGroup(group.id)
).rejects.toThrowError(`CustomerGroup with id: ${group.id} was not found`)
})
it("should delete multiple customer groups by IDs", async () => {
const groups = await service.createCustomerGroup([
{ name: "VIP" },
{ name: "Regular" },
])
const groupIds = groups.map((group) => group.id)
await service.deleteCustomerGroup(groupIds)
for (const group of groups) {
await expect(
service.retrieveCustomerGroup(group.id)
).rejects.toThrowError(
`CustomerGroup with id: ${group.id} was not found`
)
}
})
it("should delete customer groups using a selector", async () => {
await service.createCustomerGroup([{ name: "VIP" }, { name: "Regular" }])
const selector = { name: "VIP" }
await service.deleteCustomerGroup(selector)
const remainingGroups = await service.listCustomerGroups({ name: "VIP" })
expect(remainingGroups.length).toBe(0)
})
it("should cascade relationship when deleting customer group", async () => {
// Creating a customer and a group
const customer = await service.create({
first_name: "John",
last_name: "Doe",
})
const group = await service.createCustomerGroup({ name: "VIP" })
// Adding the customer to the groups
await service.addCustomerToGroup({
customer_id: customer.id,
customer_group_id: group.id,
})
await service.deleteCustomerGroup(group.id)
const res = await service.listCustomerGroupRelations({
customer_id: customer.id,
customer_group_id: group.id,
})
expect(res.length).toBe(0)
})
}) })
describe("removeCustomerFromGroup", () => { describe("removeCustomerFromGroup", () => {
@@ -496,4 +581,172 @@ describe("Customer Module Service", () => {
} }
}) })
}) })
describe("softDelete", () => {
it("should soft delete a single customer", async () => {
const [customer] = await service.create([
{ first_name: "John", last_name: "Doe" },
])
await service.softDelete([customer.id])
const res = await service.list({ id: customer.id })
expect(res.length).toBe(0)
const deletedCustomer = await service.retrieve(customer.id, {
withDeleted: true,
})
expect(deletedCustomer.deleted_at).not.toBeNull()
})
it("should soft delete multiple customers", async () => {
const customers = await service.create([
{ first_name: "John", last_name: "Doe" },
{ first_name: "Jane", last_name: "Smith" },
])
const customerIds = customers.map((customer) => customer.id)
await service.softDelete(customerIds)
const res = await service.list({ id: customerIds })
expect(res.length).toBe(0)
const deletedCustomers = await service.list(
{ id: customerIds },
{ withDeleted: true }
)
expect(deletedCustomers.length).toBe(2)
})
it("should remove customer in group relation", async () => {
// Creating a customer and a group
const customer = await service.create({
first_name: "John",
last_name: "Doe",
})
const group = await service.createCustomerGroup({ name: "VIP" })
// Adding the customer to the group
await service.addCustomerToGroup({
customer_id: customer.id,
customer_group_id: group.id,
})
await service.softDelete([customer.id])
const resGroup = await service.retrieveCustomerGroup(group.id, {
relations: ["customers"],
})
expect(resGroup.customers?.length).toBe(0)
})
})
describe("restore", () => {
it("should restore a single customer", async () => {
const [customer] = await service.create([
{ first_name: "John", last_name: "Doe" },
])
await service.softDelete([customer.id])
const res = await service.list({ id: customer.id })
expect(res.length).toBe(0)
await service.restore([customer.id])
const restoredCustomer = await service.retrieve(customer.id, {
withDeleted: true,
})
expect(restoredCustomer.deleted_at).toBeNull()
})
it("should restore multiple customers", async () => {
const customers = await service.create([
{ first_name: "John", last_name: "Doe" },
{ first_name: "Jane", last_name: "Smith" },
])
const customerIds = customers.map((customer) => customer.id)
await service.softDelete(customerIds)
const res = await service.list({ id: customerIds })
expect(res.length).toBe(0)
await service.restore(customerIds)
const restoredCustomers = await service.list(
{ id: customerIds },
{ withDeleted: true }
)
expect(restoredCustomers.length).toBe(2)
})
})
describe("softDeleteCustomerGroup", () => {
it("should soft delete a single customer group", async () => {
const [group] = await service.createCustomerGroup([{ name: "VIP" }])
await service.softDeleteCustomerGroup([group.id])
const res = await service.listCustomerGroups({ id: group.id })
expect(res.length).toBe(0)
const deletedGroup = await service.retrieveCustomerGroup(group.id, {
withDeleted: true,
})
expect(deletedGroup.deleted_at).not.toBeNull()
})
it("should soft delete multiple customer groups", async () => {
const groups = await service.createCustomerGroup([
{ name: "VIP" },
{ name: "Regular" },
])
const groupIds = groups.map((group) => group.id)
await service.softDeleteCustomerGroup(groupIds)
const res = await service.listCustomerGroups({ id: groupIds })
expect(res.length).toBe(0)
const deletedGroups = await service.listCustomerGroups(
{ id: groupIds },
{ withDeleted: true }
)
expect(deletedGroups.length).toBe(2)
})
})
describe("restoreCustomerGroup", () => {
it("should restore a single customer group", async () => {
const [group] = await service.createCustomerGroup([{ name: "VIP" }])
await service.softDeleteCustomerGroup([group.id])
const res = await service.listCustomerGroups({ id: group.id })
expect(res.length).toBe(0)
await service.restoreCustomerGroup([group.id])
const restoredGroup = await service.retrieveCustomerGroup(group.id, {
withDeleted: true,
})
expect(restoredGroup.deleted_at).toBeNull()
})
it("should restore multiple customer groups", async () => {
const groups = await service.createCustomerGroup([
{ name: "VIP" },
{ name: "Regular" },
])
const groupIds = groups.map((group) => group.id)
await service.softDeleteCustomerGroup(groupIds)
const res = await service.listCustomerGroups({ id: groupIds })
expect(res.length).toBe(0)
await service.restoreCustomerGroup(groupIds)
const restoredGroups = await service.listCustomerGroups(
{ id: groupIds },
{ withDeleted: true }
)
expect(restoredGroups.length).toBe(2)
})
})
}) })
+2 -1
View File
@@ -1,10 +1,11 @@
import { Modules } from "@medusajs/modules-sdk" import { Modules } from "@medusajs/modules-sdk"
import { ModuleJoinerConfig } from "@medusajs/types" import { ModuleJoinerConfig } from "@medusajs/types"
import { MapToConfig } from "@medusajs/utils" import { MapToConfig } from "@medusajs/utils"
import { Customer } from "@models" import { Customer, CustomerGroup } from "@models"
export const LinkableKeys = { export const LinkableKeys = {
customer_id: Customer.name, customer_id: Customer.name,
customer_group_id: CustomerGroup.name,
} }
const entityLinkableKeysMap: MapToConfig = {} const entityLinkableKeysMap: MapToConfig = {}
@@ -1,6 +1,7 @@
import { DAL } from "@medusajs/types" import { DAL } from "@medusajs/types"
import { generateEntityId } from "@medusajs/utils" import { generateEntityId } from "@medusajs/utils"
import { import {
Cascade,
BeforeCreate, BeforeCreate,
ManyToOne, ManyToOne,
Entity, Entity,
@@ -32,6 +33,7 @@ export default class CustomerGroupCustomer {
fieldName: "customer_id", fieldName: "customer_id",
index: "IDX_customer_group_customer_customer_id", index: "IDX_customer_group_customer_customer_id",
nullable: true, nullable: true,
cascade: [Cascade.REMOVE],
}) })
customer: Customer | null customer: Customer | null
@@ -40,6 +42,7 @@ export default class CustomerGroupCustomer {
fieldName: "customer_group_id", fieldName: "customer_group_id",
index: "IDX_customer_group_customer_group_id", index: "IDX_customer_group_customer_group_id",
nullable: true, nullable: true,
cascade: [Cascade.REMOVE],
}) })
customer_group: CustomerGroup | null customer_group: CustomerGroup | null
@@ -1,5 +1,5 @@
import { DAL } from "@medusajs/types" import { DAL } from "@medusajs/types"
import { generateEntityId } from "@medusajs/utils" import { DALUtils, generateEntityId } from "@medusajs/utils"
import { import {
BeforeCreate, BeforeCreate,
Entity, Entity,
@@ -9,13 +9,15 @@ import {
Property, Property,
ManyToMany, ManyToMany,
Collection, Collection,
Filter,
} from "@mikro-orm/core" } from "@mikro-orm/core"
import Customer from "./customer" import Customer from "./customer"
import CustomerGroupCustomer from "./customer-group-customer" import CustomerGroupCustomer from "./customer-group-customer"
type OptionalGroupProps = DAL.EntityDateColumns // TODO: To be revisited when more clear type OptionalGroupProps = DAL.SoftDeletableEntityDateColumns // TODO: To be revisited when more clear
@Entity({ tableName: "customer_group" }) @Entity({ tableName: "customer_group" })
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class CustomerGroup { export default class CustomerGroup {
[OptionalProps]: OptionalGroupProps [OptionalProps]: OptionalGroupProps
@@ -52,6 +54,9 @@ export default class CustomerGroup {
}) })
updated_at: Date updated_at: Date
@Property({ columnType: "timestamptz", nullable: true })
deleted_at: Date | null = null
@BeforeCreate() @BeforeCreate()
onCreate() { onCreate() {
this.id = generateEntityId(this.id, "cusgroup") this.id = generateEntityId(this.id, "cusgroup")
+4 -2
View File
@@ -1,10 +1,11 @@
import { DAL } from "@medusajs/types" import { DAL } from "@medusajs/types"
import { generateEntityId } from "@medusajs/utils" import { DALUtils, generateEntityId } from "@medusajs/utils"
import { import {
BeforeCreate, BeforeCreate,
Cascade, Cascade,
Collection, Collection,
Entity, Entity,
Filter,
Index, Index,
ManyToMany, ManyToMany,
ManyToOne, ManyToOne,
@@ -23,9 +24,10 @@ type OptionalCustomerProps =
| "addresses" | "addresses"
| "default_shipping_address" | "default_shipping_address"
| "default_billing_address" | "default_billing_address"
| DAL.EntityDateColumns | DAL.SoftDeletableEntityDateColumns
@Entity({ tableName: "customer" }) @Entity({ tableName: "customer" })
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
export default class Customer { export default class Customer {
[OptionalProps]?: OptionalCustomerProps [OptionalProps]?: OptionalCustomerProps
@@ -6,16 +6,23 @@ import {
InternalModuleDeclaration, InternalModuleDeclaration,
ModuleJoinerConfig, ModuleJoinerConfig,
CustomerTypes, CustomerTypes,
SoftDeleteReturn,
RestoreReturn,
} from "@medusajs/types" } from "@medusajs/types"
import { import {
InjectManager, InjectManager,
InjectTransactionManager, InjectTransactionManager,
MedusaContext, MedusaContext,
mapObjectTo,
isString, isString,
isObject, isObject,
} from "@medusajs/utils" } from "@medusajs/utils"
import { joinerConfig } from "../joiner-config" import {
entityNameToLinkableKeysMap,
LinkableKeys,
joinerConfig,
} from "../joiner-config"
import * as services from "../services" import * as services from "../services"
type InjectedDependencies = { type InjectedDependencies = {
@@ -264,6 +271,23 @@ export default class CustomerModuleService implements ICustomerModuleService {
return Array.isArray(dataOrArrayOfData) ? serialized : serialized[0] return Array.isArray(dataOrArrayOfData) ? serialized : serialized[0]
} }
@InjectManager("baseRepository_")
async retrieveCustomerGroup(
groupId: string,
config: FindConfig<CustomerTypes.CustomerGroupDTO> = {},
@MedusaContext() sharedContext: Context = {}
) {
const group = await this.customerGroupService_.retrieve(
groupId,
config,
sharedContext
)
return await this.baseRepository_.serialize<CustomerTypes.CustomerGroupDTO>(
group,
{ populate: true }
)
}
async updateCustomerGroup( async updateCustomerGroup(
groupId: string, groupId: string,
data: Partial<CustomerTypes.CreateCustomerGroupDTO>, data: Partial<CustomerTypes.CreateCustomerGroupDTO>,
@@ -331,6 +355,39 @@ export default class CustomerModuleService implements ICustomerModuleService {
>(groups, { populate: true }) >(groups, { populate: true })
} }
deleteCustomerGroup(groupId: string, sharedContext?: Context): Promise<void>
deleteCustomerGroup(
groupIds: string[],
sharedContext?: Context
): Promise<void>
deleteCustomerGroup(
selector: CustomerTypes.FilterableCustomerGroupProps,
sharedContext?: Context
): Promise<void>
@InjectTransactionManager("baseRepository_")
async deleteCustomerGroup(
groupIdOrSelector:
| string
| string[]
| CustomerTypes.FilterableCustomerGroupProps,
@MedusaContext() sharedContext: Context = {}
) {
let toDelete = Array.isArray(groupIdOrSelector)
? groupIdOrSelector
: [groupIdOrSelector as string]
if (isObject(groupIdOrSelector)) {
const ids = await this.customerGroupService_.list(
groupIdOrSelector,
{ select: ["id"] },
sharedContext
)
toDelete = ids.map(({ id }) => id)
}
return await this.customerGroupService_.delete(toDelete, sharedContext)
}
async addCustomerToGroup( async addCustomerToGroup(
groupCustomerPair: CustomerTypes.GroupCustomerPair, groupCustomerPair: CustomerTypes.GroupCustomerPair,
sharedContext?: Context sharedContext?: Context
@@ -382,6 +439,25 @@ export default class CustomerModuleService implements ICustomerModuleService {
) )
} }
@InjectManager("baseRepository_")
async listCustomerGroupRelations(
filters?: CustomerTypes.FilterableCustomerGroupCustomerProps,
config?: FindConfig<CustomerTypes.CustomerGroupCustomerDTO>,
@MedusaContext() sharedContext: Context = {}
) {
const groupCustomers = await this.customerGroupCustomerService_.list(
filters,
config,
sharedContext
)
return await this.baseRepository_.serialize<
CustomerTypes.CustomerGroupCustomerDTO[]
>(groupCustomers, {
populate: true,
})
}
@InjectManager("baseRepository_") @InjectManager("baseRepository_")
async listCustomerGroups( async listCustomerGroups(
filters: CustomerTypes.FilterableCustomerGroupProps = {}, filters: CustomerTypes.FilterableCustomerGroupProps = {},
@@ -423,4 +499,90 @@ export default class CustomerModuleService implements ICustomerModuleService {
count, count,
] ]
} }
@InjectTransactionManager("baseRepository_")
async softDeleteCustomerGroup<
TReturnableLinkableKeys extends string = string
>(
groupIds: string[],
config: SoftDeleteReturn<TReturnableLinkableKeys> = {},
@MedusaContext() sharedContext: Context = {}
) {
const [_, cascadedEntitiesMap] =
await this.customerGroupService_.softDelete(groupIds, sharedContext)
return config.returnLinkableKeys
? mapObjectTo<Record<TReturnableLinkableKeys, string[]>>(
cascadedEntitiesMap,
entityNameToLinkableKeysMap,
{
pick: config.returnLinkableKeys,
}
)
: void 0
}
@InjectTransactionManager("baseRepository_")
async restoreCustomerGroup<TReturnableLinkableKeys extends string = string>(
groupIds: string[],
config: RestoreReturn<TReturnableLinkableKeys> = {},
@MedusaContext() sharedContext: Context = {}
) {
const [_, cascadedEntitiesMap] = await this.customerGroupService_.restore(
groupIds,
sharedContext
)
return config.returnLinkableKeys
? mapObjectTo<Record<TReturnableLinkableKeys, string[]>>(
cascadedEntitiesMap,
entityNameToLinkableKeysMap,
{
pick: config.returnLinkableKeys,
}
)
: void 0
}
@InjectTransactionManager("baseRepository_")
async softDelete<TReturnableLinkableKeys extends string = string>(
customerIds: string[],
config: SoftDeleteReturn<TReturnableLinkableKeys> = {},
@MedusaContext() sharedContext: Context = {}
) {
const [_, cascadedEntitiesMap] = await this.customerService_.softDelete(
customerIds,
sharedContext
)
return config.returnLinkableKeys
? mapObjectTo<Record<TReturnableLinkableKeys, string[]>>(
cascadedEntitiesMap,
entityNameToLinkableKeysMap,
{
pick: config.returnLinkableKeys,
}
)
: void 0
}
@InjectTransactionManager("baseRepository_")
async restore<TReturnableLinkableKeys extends string = string>(
customerIds: string[],
config: RestoreReturn<TReturnableLinkableKeys> = {},
@MedusaContext() sharedContext: Context = {}
) {
const [_, cascadedEntitiesMap] = await this.customerService_.restore(
customerIds,
sharedContext
)
return config.returnLinkableKeys
? mapObjectTo<Record<TReturnableLinkableKeys, string[]>>(
cascadedEntitiesMap,
entityNameToLinkableKeysMap,
{
pick: config.returnLinkableKeys,
}
)
: void 0
}
} }
+36 -12
View File
@@ -2,27 +2,28 @@ import { BaseFilterable } from "../dal"
import { OperatorMap } from "../dal/utils" import { OperatorMap } from "../dal/utils"
import { AddressDTO } from "../address" import { AddressDTO } from "../address"
export interface CustomerGroupDTO {
id: string
name: string
customers?: Partial<CustomerDTO>[]
metadata?: Record<string, unknown>
created_by?: string | null
deleted_at?: Date | string | null
created_at?: Date | string
updated_at?: Date | string
}
export interface FilterableCustomerGroupProps export interface FilterableCustomerGroupProps
extends BaseFilterable<FilterableCustomerGroupProps> { extends BaseFilterable<FilterableCustomerGroupProps> {
id?: string | string[] id?: string | string[]
name?: OperatorMap<string> name?: string | OperatorMap<string>
customers?: FilterableCustomerProps | string | string[] customers?: FilterableCustomerProps | string | string[]
created_by?: string | string[] | null created_by?: string | string[] | null
created_at?: OperatorMap<string> created_at?: OperatorMap<string>
updated_at?: OperatorMap<string> updated_at?: OperatorMap<string>
} }
export interface FilterableCustomerGroupCustomerProps
extends BaseFilterable<FilterableCustomerGroupCustomerProps> {
id?: string | string[]
customer_id?: string | string[]
customer_group_id?: string | string[]
customer?: FilterableCustomerProps | string | string[]
group?: FilterableCustomerGroupProps | string | string[]
created_by?: string | string[] | null
created_at?: OperatorMap<string>
updated_at?: OperatorMap<string>
}
export interface FilterableCustomerProps export interface FilterableCustomerProps
extends BaseFilterable<FilterableCustomerProps> { extends BaseFilterable<FilterableCustomerProps> {
id?: string | string[] id?: string | string[]
@@ -38,6 +39,28 @@ export interface FilterableCustomerProps
updated_at?: OperatorMap<string> updated_at?: OperatorMap<string>
} }
export interface CustomerGroupDTO {
id: string
name: string
customers?: Partial<CustomerDTO>[]
metadata?: Record<string, unknown>
created_by?: string | null
deleted_at?: Date | string | null
created_at?: Date | string
updated_at?: Date | string
}
export interface CustomerGroupCustomerDTO {
id: string
customer_id: string
customer_group_id: string
customer?: Partial<CustomerDTO>
group?: Partial<CustomerGroupDTO>
created_by?: string | null
created_at?: Date | string
updated_at?: Date | string
}
export interface CustomerDTO { export interface CustomerDTO {
id: string id: string
email: string email: string
@@ -52,6 +75,7 @@ export interface CustomerDTO {
phone?: string | null phone?: string | null
groups?: { id: string }[] groups?: { id: string }[]
metadata?: Record<string, unknown> metadata?: Record<string, unknown>
created_by?: string | null
deleted_at?: Date | string | null deleted_at?: Date | string | null
created_at?: Date | string created_at?: Date | string
updated_at?: Date | string updated_at?: Date | string
+51 -3
View File
@@ -1,9 +1,12 @@
import { FindConfig } from "../common" import { FindConfig } from "../common"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
import { IModuleService } from "../modules-sdk" import { IModuleService } from "../modules-sdk"
import { Context } from "../shared-context" import { Context } from "../shared-context"
import { import {
CustomerDTO, CustomerDTO,
CustomerGroupDTO, CustomerGroupDTO,
CustomerGroupCustomerDTO,
FilterableCustomerGroupCustomerProps,
FilterableCustomerProps, FilterableCustomerProps,
FilterableCustomerGroupProps, FilterableCustomerGroupProps,
GroupCustomerPair, GroupCustomerPair,
@@ -21,7 +24,6 @@ export interface ICustomerModuleService extends IModuleService {
data: CreateCustomerDTO[], data: CreateCustomerDTO[],
sharedContext?: Context sharedContext?: Context
): Promise<CustomerDTO[]> ): Promise<CustomerDTO[]>
create(data: CreateCustomerDTO, sharedContext?: Context): Promise<CustomerDTO> create(data: CreateCustomerDTO, sharedContext?: Context): Promise<CustomerDTO>
update( update(
@@ -57,6 +59,12 @@ export interface ICustomerModuleService extends IModuleService {
sharedContext?: Context sharedContext?: Context
): Promise<CustomerGroupDTO> ): Promise<CustomerGroupDTO>
retrieveCustomerGroup(
groupId: string,
config?: FindConfig<CustomerGroupDTO>,
sharedContext?: Context
): Promise<CustomerGroupDTO>
updateCustomerGroup( updateCustomerGroup(
groupId: string, groupId: string,
data: Partial<CreateCustomerGroupDTO>, data: Partial<CreateCustomerGroupDTO>,
@@ -73,6 +81,16 @@ export interface ICustomerModuleService extends IModuleService {
sharedContext?: Context sharedContext?: Context
): Promise<CustomerGroupDTO[]> ): Promise<CustomerGroupDTO[]>
deleteCustomerGroup(groupId: string, sharedContext?: Context): Promise<void>
deleteCustomerGroup(
groupIds: string[],
sharedContext?: Context
): Promise<void>
deleteCustomerGroup(
selector: FilterableCustomerGroupProps,
sharedContext?: Context
): Promise<void>
addCustomerToGroup( addCustomerToGroup(
groupCustomerPair: GroupCustomerPair, groupCustomerPair: GroupCustomerPair,
sharedContext?: Context sharedContext?: Context
@@ -84,14 +102,20 @@ export interface ICustomerModuleService extends IModuleService {
): Promise<{ id: string }[]> ): Promise<{ id: string }[]>
removeCustomerFromGroup( removeCustomerFromGroup(
groupCustomerPair: { customer_id: string; customer_group_id: string }, groupCustomerPair: GroupCustomerPair,
sharedContext?: Context sharedContext?: Context
): Promise<void> ): Promise<void>
removeCustomerFromGroup( removeCustomerFromGroup(
groupCustomerPairs: { customer_id: string; customer_group_id: string }[], groupCustomerPairs: GroupCustomerPair[],
sharedContext?: Context sharedContext?: Context
): Promise<void> ): Promise<void>
listCustomerGroupRelations(
filters?: FilterableCustomerGroupCustomerProps,
config?: FindConfig<CustomerGroupCustomerDTO>,
sharedContext?: Context
): Promise<CustomerGroupCustomerDTO[]>
list( list(
filters?: FilterableCustomerProps, filters?: FilterableCustomerProps,
config?: FindConfig<CustomerDTO>, config?: FindConfig<CustomerDTO>,
@@ -115,4 +139,28 @@ export interface ICustomerModuleService extends IModuleService {
config?: FindConfig<CustomerGroupDTO>, config?: FindConfig<CustomerGroupDTO>,
sharedContext?: Context sharedContext?: Context
): Promise<[CustomerGroupDTO[], number]> ): Promise<[CustomerGroupDTO[], number]>
softDelete<TReturnableLinkableKeys extends string = string>(
customerIds: string[],
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<TReturnableLinkableKeys, string[]> | void>
restore<TReturnableLinkableKeys extends string = string>(
customerIds: string[],
config?: RestoreReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<TReturnableLinkableKeys, string[]> | void>
softDeleteCustomerGroup<TReturnableLinkableKeys extends string = string>(
groupIds: string[],
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<TReturnableLinkableKeys, string[]> | void>
restoreCustomerGroup<TReturnableLinkableKeys extends string = string>(
groupIds: string[],
config?: RestoreReturn<TReturnableLinkableKeys>,
sharedContext?: Context
): Promise<Record<TReturnableLinkableKeys, string[]> | void>
} }