fix(metadata): corrected handling of remove metadata events (#4505)

* fix(metadata): corrected handling of remove metadata events

* remove unnecessary method

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Stefan Benz 2022-10-07 10:44:28 +01:00 committed by GitHub
parent 0b7ca8a143
commit c9e2e6bc33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -24,6 +24,9 @@ func (wm *MetadataWriteModel) Reduce() error {
wm.Value = e.Value
wm.State = domain.MetadataStateActive
case *metadata.RemovedEvent:
if wm.Key != e.Key {
continue
}
wm.State = domain.MetadataStateRemoved
case *metadata.RemovedAllEvent:
wm.State = domain.MetadataStateRemoved

View File

@ -35,10 +35,6 @@ func (wm *UserMetadataWriteModel) AppendEvents(events ...eventstore.Event) {
}
}
func (wm *UserMetadataWriteModel) Reduce() error {
return wm.MetadataWriteModel.Reduce()
}
func (wm *UserMetadataWriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
ResourceOwner(wm.ResourceOwner).