Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wesone committed Apr 27, 2021
1 parent 5775055 commit 02c47fd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/Aggregates.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Custom properties can be added with the [contextProvider](Config#contextProvider

Property | Type | Attribute | Description
:--- | :--- | :--- | :---
aggregateVersion | number | `0` <small>for a new aggregateId</small> | A number indicating the amount of events that belong to the aggregate
causationEvent | object | optional | An event that caused this command. If the command returns a new event, the causationEvent will be the event's "parent"

## Event
Expand Down
21 changes: 20 additions & 1 deletion docs/EventStoreAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ Name | Type | Attribute | Description
event | object | | The event to be saved

### Return
The position of the event inside the event store or `false` if the new position of the event is already taken (conflict).
The `position` (number) of the event inside the event store or `false` if the new position of the event is already taken (conflict).

### Examples
```javascript
const position = await eventStore.save({
id: 'b42e61d5-e911-4ea8-92fd-57ceb552e712',
aggregateId: '4233fb22-76eb-4b8f-9b34-8fdcb994e370',
aggregateVersion: 0,
type: 'ANSWER_CREATED',
Expand Down Expand Up @@ -70,6 +71,24 @@ Property | Type | Attribute | Description
events | array | | An array that contains the matching events
cursor | mixed | | A cursor that can be passed to another call to `load` to scroll the result

An event that was loaded contains the additional property `position` that was given to the event during [save](#save).
So an event may look like this:
```json
{
"id": "b42e61d5-e911-4ea8-92fd-57ceb552e712",
"position": 423,
"aggregateId": "4233fb22-76eb-4b8f-9b34-8fdcb994e370",
"aggregateVersion": 0,
"type": "ANSWER_CREATED",
"timestamp": 123456789,
"correlationId": "4233fb22-76eb-4b8f-9b34-8fdcb994e370",
"causationId": null,
"payload": {
"answer": 42
}
}
```

### Examples
```javascript
const {events, cursor} = await eventStore.load({
Expand Down

0 comments on commit 02c47fd

Please sign in to comment.