fix: allow design variable empty value for email templates

This commit is contained in:
anik-ghosh-au7
2022-11-09 22:48:12 +05:30
parent b467e7002d
commit 87bf1c3045
5 changed files with 718 additions and 702 deletions

View File

@@ -40,15 +40,17 @@ func AddEmailTemplateResolver(ctx context.Context, params model.AddEmailTemplate
return nil, fmt.Errorf("empty template not allowed")
}
if strings.TrimSpace(params.Design) == "" {
return nil, fmt.Errorf("empty design not allowed")
var design string
if params.Design == nil {
design = ""
}
_, err = db.Provider.AddEmailTemplate(ctx, models.EmailTemplate{
EventName: params.EventName,
Template: params.Template,
Subject: params.Subject,
Design: params.Design,
Design: design,
})
if err != nil {
log.Debug("Failed to add email template: ", err)