mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-11 10:43:49 +00:00
f2a32871a7
* View definition added * Get templates and texts from the database. * Fill in texts in templates * Fill in texts in templates * Client API added * Weekly backup * Weekly backup * Daily backup * Weekly backup * Tests added * Corrections from merge branch * Fixes from pull request review
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/caos/logging"
|
|
iam_model "github.com/caos/zitadel/internal/iam/model"
|
|
"github.com/caos/zitadel/pkg/grpc/admin"
|
|
"github.com/golang/protobuf/ptypes"
|
|
)
|
|
|
|
func templateToModel(policy *admin.DefaultMailTemplateUpdate) *iam_model.MailTemplate {
|
|
return &iam_model.MailTemplate{
|
|
Template: policy.Template,
|
|
}
|
|
}
|
|
|
|
func templateFromModel(policy *iam_model.MailTemplate) *admin.DefaultMailTemplate {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("ADMIN-CAA7T").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("ADMIN-H52Zx").OnError(err).Debug("date parse failed")
|
|
|
|
return &admin.DefaultMailTemplate{
|
|
Template: policy.Template,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|
|
|
|
func templateViewFromModel(policy *iam_model.MailTemplateView) *admin.DefaultMailTemplateView {
|
|
creationDate, err := ptypes.TimestampProto(policy.CreationDate)
|
|
logging.Log("ADMIN-yWFs5").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(policy.ChangeDate)
|
|
logging.Log("ADMIN-JRpIO").OnError(err).Debug("date parse failed")
|
|
|
|
return &admin.DefaultMailTemplateView{
|
|
Template: policy.Template,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|