feat: add tests for email template resolvers

This commit is contained in:
Lakhan Samani
2022-07-17 13:37:34 +05:30
parent cd46da60a0
commit a48b809a89
15 changed files with 263 additions and 23 deletions

View File

@@ -12,7 +12,7 @@ type EmailTemplate struct {
Key string `json:"_key,omitempty" bson:"_key,omitempty" cql:"_key,omitempty"` // for arangodb
ID string `gorm:"primaryKey;type:char(36)" json:"_id" bson:"_id" cql:"id"`
EventName string `gorm:"unique" json:"event_name" bson:"event_name" cql:"event_name"`
Template string `gorm:"type:text" json:"endpoint" bson:"endpoint" cql:"endpoint"`
Template string `gorm:"type:text" json:"template" bson:"template" cql:"template"`
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at"`
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at"`
}

View File

@@ -81,6 +81,7 @@ func (p *provider) UpdateEmailTemplate(ctx context.Context, emailTemplate models
updateFields = strings.TrimSuffix(updateFields, ",")
query := fmt.Sprintf("UPDATE %s SET %s WHERE id = '%s'", KeySpace+"."+models.Collections.EmailTemplate, updateFields, emailTemplate.ID)
fmt.Println("=> query:", query)
err = p.db.Query(query).Exec()
if err != nil {
return nil, err