zitadel/internal/api/grpc/auth/profile_converter.go
Livio Amstutz d5f0c2375a
fix: backend bugs (#1453)
* fix: add events to query

* fix: add events to query

* displayname

* change email RO

Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
2021-03-22 17:15:24 +01:00

28 lines
793 B
Go

package auth
import (
"context"
"github.com/caos/logging"
"golang.org/x/text/language"
"github.com/caos/zitadel/internal/api/grpc/user"
"github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/pkg/grpc/auth"
)
func UpdateProfileToDomain(ctx context.Context, profile *auth.UpdateMyProfileRequest) *domain.Profile {
lang, err := language.Parse(profile.PreferredLanguage)
logging.Log("AUTH-x19v6").OnError(err).Debug("unable to parse preferred language")
return &domain.Profile{
ObjectRoot: ctxToObjectRoot(ctx),
FirstName: profile.FirstName,
LastName: profile.LastName,
NickName: profile.NickName,
DisplayName: profile.DisplayName,
PreferredLanguage: lang,
Gender: user.GenderToDomain(profile.Gender),
}
}