Closed FBurner closed 3 years ago
How are you using the EventStore? Do you inject it? Look at this example:
import { Injectable } from '@nestjs/common';
import { Hero } from '../models/hero.model';
import { EventStore } from 'event-sourcing-nestjs';
@Injectable()
export class HeroRepository {
constructor(
private readonly eventStore: EventStore,
) {}
async findOneById(id: string): Promise<Hero> {
const hero = new Hero(id);
hero.loadFromHistory(await this.eventStore.getEvents('hero', id));
return hero;
}
}
It was some internal problem with node-eventstore having no types for typescript my configuration couldnt handle it,
I have rewritten the module to be configured for azuretables and others
Seems snapshot creation was not implemented?
return new Promise<StorableEvent[]>(resolve => { this.eventstore.getFromSnapshot( this.getAgrregateId(aggregate, id), (err, snapshot, stream) => { // snapshot.data; // Snapshot resolve( stream.events.map(event => this.getStorableEventFromPayload(event.payload), ), ); }, ); });
There you try to get snap shots yet there is none created in the database and i dont see any call on createSnapshot
It's not implemented yet. I will open a new issue for this and any help will be gladly accepted 😁
I get eventstore is not a function in the Eventstore.ts