13 KiB
Class: CustomerService
Hierarchy
-
TransactionBaseService<CustomerService>↳
CustomerService
Constructors
constructor
• new CustomerService(__namedParameters)
Parameters
| Name | Type |
|---|---|
__namedParameters |
InjectedDependencies |
Overrides
TransactionBaseService<CustomerService>.constructor
Defined in
Properties
addressRepository_
• Protected Readonly addressRepository_: typeof AddressRepository
Defined in
configModule
• Protected Optional Readonly configModule: Record<string, unknown>
Inherited from
TransactionBaseService.configModule
container
• Protected Readonly container: unknown
Inherited from
TransactionBaseService.container
customerRepository_
• Protected Readonly customerRepository_: typeof CustomerRepository
Defined in
eventBusService_
• Protected Readonly eventBusService_: EventBusService
Defined in
manager_
• Protected Readonly manager_: EntityManager
Overrides
TransactionBaseService.manager_
Defined in
transactionManager_
• Protected Readonly transactionManager_: undefined | EntityManager
Overrides
TransactionBaseService.transactionManager_
Defined in
Events
▪ Static Events: Object
Type declaration
| Name | Type |
|---|---|
CREATED |
string |
PASSWORD_RESET |
string |
UPDATED |
string |
Defined in
Methods
addAddress
▸ addAddress(customerId, address): Promise<Address | Customer>
Parameters
| Name | Type |
|---|---|
customerId |
string |
address |
AddressCreatePayload |
Returns
Promise<Address | Customer>
Defined in
atomicPhase_
▸ Protected atomicPhase_<TResult, TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>
Type parameters
| Name |
|---|
TResult |
TError |
Parameters
| Name | Type | Description |
|---|---|---|
work |
(transactionManager: EntityManager) => Promise<TResult> |
|
isolationOrErrorHandler? |
IsolationLevel | (error: TError) => Promise<void | TResult> |
|
maybeErrorHandlerOrDontFail? |
(error: TError) => Promise<void | TResult> |
Returns
Promise<TResult>
Inherited from
TransactionBaseService.atomicPhase_
Defined in
interfaces/transaction-base-service.ts:53
count
▸ count(): Promise<number>
Returns
Promise<number>
Defined in
create
▸ create(customer): Promise<Customer>
Parameters
| Name | Type | Description |
|---|---|---|
customer |
CreateCustomerInput |
Returns
Promise<Customer>
Defined in
delete
▸ delete(customerId): Promise<void | Customer>
Parameters
| Name | Type | Description |
|---|---|---|
customerId |
string |
Returns
Promise<void | Customer>
Defined in
generateResetPasswordToken
▸ generateResetPasswordToken(customerId): Promise<string>
Parameters
| Name | Type | Description |
|---|---|---|
customerId |
string |
Returns
Promise<string>
Defined in
hashPassword_
▸ hashPassword_(password): Promise<string>
Parameters
| Name | Type | Description |
|---|---|---|
password |
string |
Returns
Promise<string>
Defined in
list
▸ list(selector?, config?): Promise<Customer[]>
Parameters
| Name | Type | Description |
|---|---|---|
selector |
Selector<Customer> & { q?: string } |
|
config |
FindConfig<Customer> |
Returns
Promise<Customer[]>
Defined in
listAndCount
▸ listAndCount(selector, config?): Promise<[Customer[], number]>
Parameters
| Name | Type | Description |
|---|---|---|
selector |
Selector<Customer> & { q?: string } |
|
config |
FindConfig<Customer> |
Returns
Promise<[Customer[], number]>
Defined in
removeAddress
▸ removeAddress(customerId, addressId): Promise<void>
Parameters
| Name | Type |
|---|---|
customerId |
string |
addressId |
string |
Returns
Promise<void>
Defined in
retrieve
▸ retrieve(customerId, config?): Promise<Customer>
Parameters
| Name | Type | Description |
|---|---|---|
customerId |
string |
|
config |
FindConfig<Customer> |
Returns
Promise<Customer>
Defined in
retrieveByEmail
▸ retrieveByEmail(email, config?): Promise<Customer>
Parameters
| Name | Type | Description |
|---|---|---|
email |
string |
|
config |
FindConfig<Customer> |
Returns
Promise<Customer>
Defined in
retrieveByPhone
▸ retrieveByPhone(phone, config?): Promise<Customer>
Parameters
| Name | Type | Description |
|---|---|---|
phone |
string |
|
config |
FindConfig<Customer> |
Returns
Promise<Customer>
Defined in
retrieve_
▸ Private retrieve_(selector, config?): Promise<Customer>
Parameters
| Name | Type |
|---|---|
selector |
Selector<Customer> |
config |
FindConfig<Customer> |
Returns
Promise<Customer>
Defined in
shouldRetryTransaction_
▸ Protected shouldRetryTransaction_(err): boolean
Parameters
| Name | Type |
|---|---|
err |
Record<string, unknown> | { code: string } |
Returns
boolean
Inherited from
TransactionBaseService.shouldRetryTransaction_
Defined in
interfaces/transaction-base-service.ts:34
update
▸ update(customerId, update): Promise<Customer>
Parameters
| Name | Type | Description |
|---|---|---|
customerId |
string |
|
update |
UpdateCustomerInput |
Returns
Promise<Customer>
Defined in
updateAddress
▸ updateAddress(customerId, addressId, address): Promise<Address>
Parameters
| Name | Type |
|---|---|
customerId |
string |
addressId |
string |
address |
StorePostCustomersCustomerAddressesAddressReq |
Returns
Promise<Address>
Defined in
updateBillingAddress_
▸ updateBillingAddress_(customer, addressOrId): Promise<void>
Parameters
| Name | Type | Description |
|---|---|---|
customer |
Customer |
|
addressOrId |
undefined | string | { address_1?: null | string ; address_2?: null | string ; city?: null | string ; company?: null | string ; country?: null | { id?: number | undefined; iso_2?: string | undefined; iso_3?: string | undefined; num_code?: number | undefined; name?: string | undefined; display_name?: string | undefined; region_id?: string | ... 1 more ... | undefined; region?: { ...; } | undefined; } ; country_code?: null | string ; created_at?: { toString?: {} | undefined; toDateString?: {} | undefined; toTimeString?: {} | undefined; toLocaleString?: {} | undefined; toLocaleDateString?: {} | undefined; toLocaleTimeString?: {} | undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} | undefined; } ; customer?: null | { email?: string | undefined; first_name?: string | undefined; last_name?: string | undefined; billing_address_id?: string | null | undefined; billing_address?: { customer_id?: string | null | undefined; ... 16 more ...; updated_at?: { ...; } | undefined; } | undefined; ... 10 more ...; updated_at?: { ...; } | undef... ; customer_id?: null | string ; deleted_at?: null | { toString?: {} | undefined; toDateString?: {} | undefined; toTimeString?: {} | undefined; toLocaleString?: {} | undefined; toLocaleDateString?: {} | undefined; toLocaleTimeString?: {} | undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} | undefined; } ; first_name?: null | string ; id?: string ; last_name?: null | string ; metadata?: { [x: string]: unknown; } ; phone?: null | string ; postal_code?: null | string ; province?: null | string ; updated_at?: { toString?: {} | undefined; toDateString?: {} | undefined; toTimeString?: {} | undefined; toLocaleString?: {} | undefined; toLocaleDateString?: {} | undefined; toLocaleTimeString?: {} | undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} | undefined; } } |
Returns
Promise<void>
Defined in
withTransaction
▸ withTransaction(transactionManager?): CustomerService
Parameters
| Name | Type |
|---|---|
transactionManager? |
EntityManager |
Returns
Inherited from
TransactionBaseService.withTransaction