mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
dc56e298ae
* fix: use domain models for v2 eventstore * fix: user domain model * Update internal/api/grpc/admin/login_policy_converter.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: converter Co-authored-by: Livio Amstutz <livio.a@gmail.com>
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/caos/logging"
|
|
iam_model "github.com/caos/zitadel/internal/iam/model"
|
|
"github.com/caos/zitadel/internal/v2/domain"
|
|
"github.com/caos/zitadel/pkg/grpc/admin"
|
|
"github.com/golang/protobuf/ptypes"
|
|
)
|
|
|
|
func labelPolicyToDomain(policy *admin.DefaultLabelPolicyUpdate) *domain.LabelPolicy {
|
|
return &domain.LabelPolicy{
|
|
PrimaryColor: policy.PrimaryColor,
|
|
SecondaryColor: policy.SecondaryColor,
|
|
}
|
|
}
|
|
|
|
func labelPolicyFromDomain(policy *domain.LabelPolicy) *admin.DefaultLabelPolicy {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("ADMIN-QwQG9").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("ADMIN-mAgcI").OnError(err).Debug("date parse failed")
|
|
|
|
return &admin.DefaultLabelPolicy{
|
|
PrimaryColor: policy.PrimaryColor,
|
|
SecondaryColor: policy.SecondaryColor,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|
|
|
|
func labelPolicyViewFromModel(policy *iam_model.LabelPolicyView) *admin.DefaultLabelPolicyView {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("ADMIN-zMnlF").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("ADMIN-Vhvfp").OnError(err).Debug("date parse failed")
|
|
|
|
return &admin.DefaultLabelPolicyView{
|
|
PrimaryColor: policy.PrimaryColor,
|
|
SecondaryColor: policy.SecondaryColor,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|