feat: make AbstractModuleService create method type-safe (#11216)

This commit is contained in:
Harminder Virk
2025-02-03 21:25:01 +05:30
committed by GitHub
parent 6cd8249a2c
commit 016e332e9b
23 changed files with 677 additions and 35 deletions
@@ -162,11 +162,13 @@ export default class CustomerModuleService
data: CustomerTypes.CustomerUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerDTO>
// @ts-expect-error
updateCustomers(
customerIds: string[],
data: CustomerTypes.CustomerUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerDTO[]>
// @ts-expect-error
updateCustomers(
selector: CustomerTypes.FilterableCustomerProps,
data: CustomerTypes.CustomerUpdatableFields,
@@ -174,6 +176,7 @@ export default class CustomerModuleService
): Promise<CustomerTypes.CustomerDTO[]>
@InjectTransactionManager()
// @ts-expect-error
async updateCustomers(
idsOrSelector: string | string[] | CustomerTypes.FilterableCustomerProps,
data: CustomerTypes.CustomerUpdatableFields,
@@ -224,12 +227,14 @@ export default class CustomerModuleService
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO>
// @ts-expect-error
async createCustomerGroups(
dataOrArrayOfData: CustomerTypes.CreateCustomerGroupDTO[],
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO[]>
@InjectTransactionManager()
// @ts-expect-error
async createCustomerGroups(
dataOrArrayOfData:
| CustomerTypes.CreateCustomerGroupDTO
@@ -254,11 +259,13 @@ export default class CustomerModuleService
data: CustomerTypes.CustomerGroupUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO>
// @ts-expect-error
async updateCustomerGroups(
groupIds: string[],
data: CustomerTypes.CustomerGroupUpdatableFields,
sharedContext?: Context
): Promise<CustomerTypes.CustomerGroupDTO[]>
// @ts-expect-error
async updateCustomerGroups(
selector: CustomerTypes.FilterableCustomerGroupProps,
data: CustomerTypes.CustomerGroupUpdatableFields,
@@ -266,6 +273,7 @@ export default class CustomerModuleService
): Promise<CustomerTypes.CustomerGroupDTO[]>
@InjectTransactionManager()
// @ts-expect-error
async updateCustomerGroups(
groupIdOrSelector:
| string
@@ -350,12 +358,14 @@ export default class CustomerModuleService
addresses: CustomerTypes.CreateCustomerAddressDTO[],
sharedContext?: Context
): Promise<CustomerTypes.CustomerAddressDTO[]>
// @ts-expect-error
async createCustomerAddresses(
address: CustomerTypes.CreateCustomerAddressDTO,
sharedContext?: Context
): Promise<CustomerTypes.CustomerAddressDTO>
@InjectManager()
// @ts-expect-error
async createCustomerAddresses(
data:
| CustomerTypes.CreateCustomerAddressDTO
@@ -396,11 +406,13 @@ export default class CustomerModuleService
data: CustomerTypes.UpdateCustomerAddressDTO,
sharedContext?: Context
): Promise<CustomerTypes.CustomerAddressDTO>
// @ts-expect-error
async updateCustomerAddresses(
addressIds: string[],
data: CustomerTypes.UpdateCustomerAddressDTO,
sharedContext?: Context
): Promise<CustomerTypes.CustomerAddressDTO[]>
// @ts-expect-error
async updateCustomerAddresses(
selector: CustomerTypes.FilterableCustomerAddressProps,
data: CustomerTypes.UpdateCustomerAddressDTO,
@@ -408,6 +420,7 @@ export default class CustomerModuleService
): Promise<CustomerTypes.CustomerAddressDTO[]>
@InjectTransactionManager()
// @ts-expect-error
async updateCustomerAddresses(
addressIdOrSelector:
| string