mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 21:53:41 +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.4 KiB
Go
43 lines
1.4 KiB
Go
package management
|
|
|
|
import (
|
|
"github.com/caos/logging"
|
|
iam_model "github.com/caos/zitadel/internal/iam/model"
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
"github.com/golang/protobuf/ptypes"
|
|
)
|
|
|
|
func mailTemplateRequestToModel(mailTemplate *management.MailTemplateUpdate) *iam_model.MailTemplate {
|
|
return &iam_model.MailTemplate{
|
|
Template: mailTemplate.Template,
|
|
}
|
|
}
|
|
|
|
func mailTemplateFromModel(mailTemplate *iam_model.MailTemplate) *management.MailTemplate {
|
|
creationDate, err := ptypes.TimestampProto(mailTemplate.CreationDate)
|
|
logging.Log("MANAG-ULKZ6").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(mailTemplate.ChangeDate)
|
|
logging.Log("MANAG-451rI").OnError(err).Debug("date parse failed")
|
|
return &management.MailTemplate{
|
|
Template: mailTemplate.Template,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|
|
|
|
func mailTemplateViewFromModel(mailTemplate *iam_model.MailTemplateView) *management.MailTemplateView {
|
|
creationDate, err := ptypes.TimestampProto(mailTemplate.CreationDate)
|
|
logging.Log("MANAG-koQnB").OnError(err).Debug("date parse failed")
|
|
|
|
changeDate, err := ptypes.TimestampProto(mailTemplate.ChangeDate)
|
|
logging.Log("MANAG-ToDhD").OnError(err).Debug("date parse failed")
|
|
|
|
return &management.MailTemplateView{
|
|
Default: mailTemplate.Default,
|
|
Template: mailTemplate.Template,
|
|
CreationDate: creationDate,
|
|
ChangeDate: changeDate,
|
|
}
|
|
}
|