MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / StoreEmails

Method StoreEmails

services/email.service.go:170–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168}
169
170func (emailService *EmailService) StoreEmails() (err error) {
171 activate := []string{"activate", "Welcome"}
172 activationLink := []string{"activationLink", "Activation link"}
173 forgotPassword := []string{"forgotPassword", "Forgot password"}
174 notification := []string{"notification", "Notification"}
175 for _, email := range [][]string{activate, activationLink, forgotPassword, notification} {
176 code := email[0]
177 title := email[1]
178 storedEmail, _ := loadEmail(code, "en")
179 if storedEmail.Code == "" {
180 template, _ := ioutil.ReadFile(fmt.Sprintf("./emails/%s.email.liquid", code))
181 email := &models.Email{}
182 email.Body = string(template)
183 email.Code = code
184 email.Lang = "en"
185 email.Subject = fmt.Sprintf("[StarterSaaS] %s", title)
186 err = emailService.getCollection().Create(email)
187 }
188 }
189 return err
190}

Callers 1

storeEmailsFunction · 0.80

Calls 3

getCollectionMethod · 0.95
loadEmailFunction · 0.85
CreateMethod · 0.45

Tested by

no test coverage detected