3.9 KiB
Class: NoteService
Hierarchy
-
"medusa-interfaces"↳
NoteService
Constructors
constructor
• new NoteService(__namedParameters)
Parameters
| Name | Type |
|---|---|
__namedParameters |
Object |
Overrides
BaseService.constructor
Defined in
Properties
Events
▪ Static Events: Object
Type declaration
| Name | Type |
|---|---|
CREATED |
string |
DELETED |
string |
UPDATED |
string |
Defined in
Methods
create
▸ create(data, config?): Promise<any>
Creates a note associated with a given author
Parameters
| Name | Type | Description |
|---|---|---|
data |
CreateNoteInput |
the note to create |
config |
any |
any configurations if needed, including meta data |
Returns
Promise<any>
resolves to the creation result
Defined in
delete
▸ delete(noteId): Promise<any>
Deletes a given note
Parameters
| Name | Type | Description |
|---|---|---|
noteId |
any |
id of the note to delete |
Returns
Promise<any>
Defined in
list
▸ list(selector, config?): Promise<Note[]>
Fetches all notes related to the given selector
Parameters
| Name | Type | Description |
|---|---|---|
selector |
any |
the query object for find |
config |
Object |
the configuration used to find the objects. contains relations, skip, and take. |
config.relations |
string[] |
Which relations to include in the resulting list of Notes. |
config.skip |
number |
How many Notes to skip in the resulting list of Notes. |
config.take |
number |
How many Notes to take in the resulting list of Notes. |
Returns
Promise<Note[]>
notes related to the given search.
Defined in
retrieve
▸ retrieve(id, config?): Promise<Note>
Retrieves a specific note.
Parameters
| Name | Type | Description |
|---|---|---|
id |
string |
the id of the note to retrieve. |
config |
any |
any options needed to query for the result. |
Returns
Promise<Note>
which resolves to the requested note.
Defined in
update
▸ update(noteId, value): Promise<any>
Updates a given note with a new value
Parameters
| Name | Type | Description |
|---|---|---|
noteId |
any |
the id of the note to update |
value |
any |
the new value |
Returns
Promise<any>
resolves to the updated element
Defined in
withTransaction
▸ withTransaction(transactionManager): NoteService
Sets the service's manager to a given transaction manager
Parameters
| Name | Type | Description |
|---|---|---|
transactionManager |
EntityManager |
the manager to use |
Returns
a cloned note service