2021-01-04 13:52:13 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
2021-01-05 08:33:45 +00:00
|
|
|
"github.com/caos/zitadel/internal/v2/domain"
|
2021-01-04 13:52:13 +00:00
|
|
|
)
|
|
|
|
|
2021-01-05 08:33:45 +00:00
|
|
|
func writeModelToUser(wm *UserWriteModel) *domain.User {
|
|
|
|
return &domain.User{
|
2021-01-04 13:52:13 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
UserName: wm.UserName,
|
2021-01-05 08:33:45 +00:00
|
|
|
State: wm.UserState,
|
2021-01-04 13:52:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-05 08:33:45 +00:00
|
|
|
func writeModelToHuman(wm *HumanWriteModel) *domain.Human {
|
|
|
|
return &domain.Human{
|
2021-01-04 13:52:13 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
2021-01-05 08:33:45 +00:00
|
|
|
Profile: &domain.Profile{
|
2021-01-04 13:52:13 +00:00
|
|
|
FirstName: wm.FirstName,
|
|
|
|
LastName: wm.LastName,
|
|
|
|
NickName: wm.NickName,
|
|
|
|
DisplayName: wm.DisplayName,
|
|
|
|
PreferredLanguage: wm.PreferredLanguage,
|
2021-01-05 08:33:45 +00:00
|
|
|
Gender: wm.Gender,
|
2021-01-04 13:52:13 +00:00
|
|
|
},
|
2021-01-05 08:33:45 +00:00
|
|
|
Email: &domain.Email{
|
2021-01-04 13:52:13 +00:00
|
|
|
EmailAddress: wm.Email,
|
|
|
|
IsEmailVerified: wm.IsEmailVerified,
|
|
|
|
},
|
2021-01-05 08:33:45 +00:00
|
|
|
Address: &domain.Address{
|
|
|
|
Country: wm.Country,
|
|
|
|
Locality: wm.Locality,
|
|
|
|
PostalCode: wm.PostalCode,
|
|
|
|
Region: wm.Region,
|
|
|
|
StreetAddress: wm.StreetAddress,
|
|
|
|
},
|
2021-01-04 13:52:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-06 10:12:56 +00:00
|
|
|
func writeModelToProfile(wm *HumanProfileWriteModel) *domain.Profile {
|
|
|
|
return &domain.Profile{
|
2021-01-04 13:52:13 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
FirstName: wm.FirstName,
|
|
|
|
LastName: wm.LastName,
|
|
|
|
NickName: wm.NickName,
|
|
|
|
DisplayName: wm.DisplayName,
|
|
|
|
PreferredLanguage: wm.PreferredLanguage,
|
2021-01-06 10:12:56 +00:00
|
|
|
Gender: wm.Gender,
|
2021-01-04 13:52:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-06 10:12:56 +00:00
|
|
|
func writeModelToEmail(wm *HumanEmailWriteModel) *domain.Email {
|
|
|
|
return &domain.Email{
|
2021-01-04 13:52:13 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
EmailAddress: wm.Email,
|
|
|
|
IsEmailVerified: wm.IsEmailVerified,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-07 15:06:45 +00:00
|
|
|
func writeModelToPhone(wm *HumanPhoneWriteModel) *domain.Phone {
|
|
|
|
return &domain.Phone{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
PhoneNumber: wm.Phone,
|
|
|
|
IsPhoneVerified: wm.IsPhoneVerified,
|
|
|
|
}
|
|
|
|
}
|
2021-01-06 10:12:56 +00:00
|
|
|
func writeModelToAddress(wm *HumanAddressWriteModel) *domain.Address {
|
|
|
|
return &domain.Address{
|
2021-01-04 13:52:13 +00:00
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
Country: wm.Country,
|
|
|
|
Locality: wm.Locality,
|
|
|
|
PostalCode: wm.PostalCode,
|
|
|
|
Region: wm.Region,
|
|
|
|
StreetAddress: wm.StreetAddress,
|
|
|
|
}
|
|
|
|
}
|
2021-01-06 10:12:56 +00:00
|
|
|
|
|
|
|
func writeModelToMachine(wm *MachineWriteModel) *domain.Machine {
|
|
|
|
return &domain.Machine{
|
|
|
|
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
|
|
|
|
Name: wm.Name,
|
|
|
|
Description: wm.Description,
|
|
|
|
}
|
|
|
|
}
|