Adds CRUD and preview APIs, RBAC permissions, seeded system templates, and migrates OTP email/SMS to template rendering. Co-authored-by: Cursor <cursoragent@cursor.com>
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
const (
|
|
EmailTemplateStatusActive = "ACTIVE"
|
|
EmailTemplateStatusInactive = "INACTIVE"
|
|
|
|
EmailTemplateSlugOTP = "otp"
|
|
EmailTemplateSlugInvitation = "invitation"
|
|
EmailTemplateSlugPasswordReset = "password_reset"
|
|
EmailTemplateSlugWelcome = "welcome"
|
|
EmailTemplateSlugCustomMessage = "custom_message"
|
|
)
|
|
|
|
type EmailTemplate struct {
|
|
ID int64 `json:"id"`
|
|
Slug string `json:"slug"`
|
|
Name string `json:"name"`
|
|
Subject string `json:"subject"`
|
|
BodyText string `json:"body_text"`
|
|
BodyHTML string `json:"body_html"`
|
|
Variables []string `json:"variables"`
|
|
IsSystem bool `json:"is_system"`
|
|
Status string `json:"status"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
|
}
|
|
|
|
type RenderedEmail struct {
|
|
Subject string `json:"subject"`
|
|
Text string `json:"text"`
|
|
HTML string `json:"html"`
|
|
}
|
|
|
|
type CreateEmailTemplateInput struct {
|
|
Slug string
|
|
Name string
|
|
Subject string
|
|
BodyText string
|
|
BodyHTML string
|
|
Variables []string
|
|
Status *string
|
|
}
|
|
|
|
type UpdateEmailTemplateInput struct {
|
|
Name *string
|
|
Subject *string
|
|
BodyText *string
|
|
BodyHTML *string
|
|
Variables []string
|
|
Status *string
|
|
}
|
|
|
|
type PreviewEmailTemplateInput struct {
|
|
Slug string
|
|
Variables map[string]any
|
|
}
|