3.8 KiB
Class: StoreService
Provides layer to manipulate store settings.
Hierarchy
-
"medusa-interfaces"↳
StoreService
Constructors
constructor
• new StoreService(__namedParameters)
Parameters
| Name | Type |
|---|---|
__namedParameters |
Object |
Overrides
BaseService.constructor
Defined in
Methods
addCurrency
▸ addCurrency(code): Promise<any>
Add a currency to the store
Parameters
| Name | Type | Description |
|---|---|---|
code |
string |
3 character ISO currency code |
Returns
Promise<any>
result after update
Defined in
create
▸ create(): Promise<Store>
Creates a store if it doesn't already exist.
Returns
Promise<Store>
the store.
Defined in
decorate
▸ decorate(store, fields, expandFields?): Store
Decorates a store object.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
store |
Store |
undefined |
the store to decorate. |
fields |
string[] |
undefined |
the fields to include. |
expandFields |
string[] |
[] |
fields to expand. |
Returns
Store
return the decorated Store.
Defined in
getDefaultCurrency_
▸ getDefaultCurrency_(code): Object
Parameters
| Name | Type |
|---|---|
code |
any |
Returns
Object
| Name | Type |
|---|---|
code |
any |
name |
any |
symbol |
any |
symbol_native |
any |
Defined in
removeCurrency
▸ removeCurrency(code): Promise<any>
Removes a currency from the store
Parameters
| Name | Type | Description |
|---|---|---|
code |
string |
3 character ISO currency code |
Returns
Promise<any>
result after update
Defined in
retrieve
▸ retrieve(relations?): Promise<Store>
Retrieve the store settings. There is always a maximum of one store.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
relations |
string[] |
[] |
relations to fetch with store |
Returns
Promise<Store>
the store
Defined in
update
▸ update(update): Promise<any>
Updates a store
Parameters
| Name | Type | Description |
|---|---|---|
update |
any |
an object with the update values. |
Returns
Promise<any>
resolves to the update result.
Defined in
withTransaction
▸ withTransaction(transactionManager): StoreService
Parameters
| Name | Type |
|---|---|
transactionManager |
any |