reimagined / resolve

Full stack CQRS, DDD, Event Sourcing framework for Node.js

Home Page:https://reimagined.github.io/resolve/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use loadEvents with startTime and endTime

pavsenin opened this issue · comments

To Reproduce
Steps to reproduce the behavior:

Execute the following code in api-handler:

const eventFilter = {
startTime: new Date('2021-09-16T09:00:00').getTime() / 1000,
endTime: new Date('2021-11-20T09:30:00').getTime() / 1000,
limit: 2000,
eventsSizeLimit: Number.MAX_SAFE_INTEGER,
eventTypes: [
UPLOAD_CREATED
]
};
const result = await req.resolve.eventstoreAdapter.loadEvents(eventFilter);
await res.json(result);

Expected behavior
The list of events is returned.

This was fixed in #2142 and available since 0.33.4
However the current documentation is wrong at some places and lacks details. For example the right key is finishTime, not endTime. Also startTime and finishTime are in milliseconds, so no need to use division.
Please note also that the cursor returned from loadEvents with timestamp filter is currently invalid and can't be used in consequent calls to loadEvents.