Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileEventStore replaces previous events when appending new ones #152

Open
sylvaindesve opened this issue Sep 12, 2021 · 0 comments
Open

Comments

@sylvaindesve
Copy link

public async append(id: Identity, eventStream: DomainEventStream): Promise<void> {
const events = await eventStream.pipe(toArray()).toPromise();
const serialized = events.map((event) => toFile(event, this.serializer));
this.fileSystem.writeFileSync(this.file, JSON.stringify(serialized));
await this.repository.append(id, eventStream);
}

This code writes the newly appended events to file, replacing older events.
This should load previous events from the InMemoryRepositoryStore and concat the new ones before saving to file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant