fix: user projection (#2795)

* fix: first- and lastname changes on user

* add reset migration
This commit is contained in:
Livio Amstutz 2021-12-06 17:22:59 +01:00 committed by GitHub
parent f0a77e80bf
commit 2ad03285f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"database/sql"
"github.com/caos/logging"
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/eventstore"
@ -379,10 +380,13 @@ func (p *UserProjection) reduceHumanProfileChanged(event eventstore.EventReader)
return nil, errors.ThrowInvalidArgument(nil, "HANDL-769v4", "reduce.wrong.event.type")
}
cols := make([]handler.Column, 0, 6)
cols = append(cols,
handler.NewCol(HumanFistNameCol, e.FirstName),
handler.NewCol(HumanLastNameCol, e.LastName),
)
if e.FirstName != "" {
cols = append(cols, handler.NewCol(HumanFistNameCol, e.FirstName))
}
if e.LastName != "" {
cols = append(cols, handler.NewCol(HumanLastNameCol, e.LastName))
}
if e.NickName != nil {
cols = append(cols, handler.NewCol(HumanNickNameCol, *e.NickName))

View File

@ -0,0 +1,2 @@
truncate zitadel.projections.users cascade;
update zitadel.projections.current_sequences set current_sequence = 0 where projection_name = 'zitadel.projections.users';