fix(eventstore): correct creation date of events (#5683)

* fix: add setup step to correct creation dates

* fix(eventstore): replace now with statement ts

* fix(step10): correct number

* fix: handle wrong instance domain removed events
This commit is contained in:
Silvan
2023-04-18 19:29:04 +02:00
committed by GitHub
parent c420de1533
commit 8da8fbe6ce
7 changed files with 106 additions and 16 deletions

View File

@@ -59,12 +59,16 @@ func (wm *SystemConfigWriteModel) Reduce() error {
}
wm.Instances[e.Aggregate().InstanceID].Domains = append(wm.Instances[e.Aggregate().InstanceID].Domains, e.Domain)
case *instance.DomainRemovedEvent:
domains := wm.Instances[e.Aggregate().InstanceID].Domains
for i, domain := range domains {
instance, ok := wm.Instances[e.Aggregate().InstanceID]
if !ok {
continue
}
for i, domain := range instance.Domains {
if domain == e.Domain {
domains[i] = domains[len(domains)-1]
domains[len(domains)-1] = ""
wm.Instances[e.Aggregate().InstanceID].Domains = domains[:len(domains)-1]
instance.Domains[i] = instance.Domains[len(instance.Domains)-1]
instance.Domains[len(instance.Domains)-1] = ""
wm.Instances[e.Aggregate().InstanceID].Domains = instance.Domains[:len(instance.Domains)-1]
break
}
}