mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-14 06:13:44 +00:00
feat: e-mail templates (#1158)
* 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
This commit is contained in:
45
internal/api/grpc/management/mail_text.go
Normal file
45
internal/api/grpc/management/mail_text.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package management
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/caos/zitadel/pkg/grpc/management"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
)
|
||||
|
||||
func (s *Server) GetMailTexts(ctx context.Context, _ *empty.Empty) (*management.MailTextsView, error) {
|
||||
result, err := s.org.GetMailTexts(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mailTextsViewFromModel(result.Texts), nil
|
||||
}
|
||||
|
||||
func (s *Server) GetDefaultMailTexts(ctx context.Context, _ *empty.Empty) (*management.MailTextsView, error) {
|
||||
result, err := s.org.GetDefaultMailTexts(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mailTextsViewFromModel(result.Texts), nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateMailText(ctx context.Context, mailText *management.MailTextUpdate) (*management.MailText, error) {
|
||||
result, err := s.org.AddMailText(ctx, mailTextRequestToModel(mailText))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mailTextFromModel(result), nil
|
||||
}
|
||||
|
||||
func (s *Server) UpdateMailText(ctx context.Context, mailText *management.MailTextUpdate) (*management.MailText, error) {
|
||||
result, err := s.org.ChangeMailText(ctx, mailTextRequestToModel(mailText))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mailTextFromModel(result), nil
|
||||
}
|
||||
|
||||
func (s *Server) RemoveMailText(ctx context.Context, mailText *management.MailTextRemove) (*empty.Empty, error) {
|
||||
err := s.org.RemoveMailText(ctx, mailTextRemoveToModel(mailText))
|
||||
return &empty.Empty{}, err
|
||||
}
|
||||
Reference in New Issue
Block a user