mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-30 16:08:56 +00:00
feat: New event user (#1156)
* feat: change user command side * feat: change user command side * feat: use states on write model * feat: command and query side in auth api * feat: auth commands * feat: check external idp id * feat: user state check * fix: error messages * fix: is active state
This commit is contained in:
@@ -16,7 +16,7 @@ type HumanAddressWriteModel struct {
|
||||
Region string
|
||||
StreetAddress string
|
||||
|
||||
UserState domain.UserState
|
||||
State domain.AddressState
|
||||
}
|
||||
|
||||
func NewHumanAddressWriteModel(userID string) *HumanAddressWriteModel {
|
||||
@@ -49,14 +49,14 @@ func (wm *HumanAddressWriteModel) Reduce() error {
|
||||
wm.PostalCode = e.PostalCode
|
||||
wm.Region = e.Region
|
||||
wm.StreetAddress = e.StreetAddress
|
||||
wm.UserState = domain.UserStateActive
|
||||
wm.State = domain.AddressStateActive
|
||||
case *user.HumanRegisteredEvent:
|
||||
wm.Country = e.Country
|
||||
wm.Locality = e.Locality
|
||||
wm.PostalCode = e.PostalCode
|
||||
wm.Region = e.Region
|
||||
wm.StreetAddress = e.StreetAddress
|
||||
wm.UserState = domain.UserStateActive
|
||||
wm.State = domain.AddressStateActive
|
||||
case *user.HumanAddressChangedEvent:
|
||||
if e.Country != nil {
|
||||
wm.Country = *e.Country
|
||||
@@ -74,7 +74,7 @@ func (wm *HumanAddressWriteModel) Reduce() error {
|
||||
wm.StreetAddress = *e.StreetAddress
|
||||
}
|
||||
case *user.UserRemovedEvent:
|
||||
wm.UserState = domain.UserStateDeleted
|
||||
wm.State = domain.AddressStateRemoved
|
||||
}
|
||||
}
|
||||
return wm.WriteModel.Reduce()
|
||||
|
||||
Reference in New Issue
Block a user