feat(notifications+admin): SMS (Kavenegar) + Email (SMTP) channels & templates
Build backend images / build content-svc (push) Failing after 56s
Build backend images / build file-svc (push) Failing after 47s
Build backend images / build gateway (push) Failing after 1m0s
Build backend images / build identity-svc (push) Failing after 56s
Build backend images / build notification-svc (push) Failing after 11s
Build backend images / build render-svc (push) Failing after 4m5s
Build backend images / build studio-svc (push) Failing after 56s

Backend (notification-svc):
- channel_config table (per-tenant Kavenegar + SMTP settings) + migration 18
- sender pkg: Kavenegar SMS client + SMTP mailer (STARTTLS / implicit TLS), stdlib only
- endpoints: GET/PUT /v1/channels[/:channel], POST /v1/sms/send, POST /v1/email/send
  (template + {{var}} rendering); deliveries logged
- seeded 3 Persian email templates: welcome / account_verification / promotion
- gateway routes /v1/{channels,sms,email}/* → notification

Admin UI:
- /admin/messaging: SMS + Email provider config cards, test-send, email template editor
- nav link + fa/en labels

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-02 17:32:54 +03:30
parent e3f025cd2d
commit 507ac7e6a4
12 changed files with 735 additions and 2 deletions
@@ -193,3 +193,33 @@ type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
}
// ── Channel provider config (SMS / Email) ────────────────────────────────────
type ChannelConfig struct {
TenantID uuid.UUID `json:"tenant_id"`
Channel string `json:"channel"` // 'sms' | 'email'
Settings map[string]any `json:"settings"`
Enabled bool `json:"enabled"`
UpdatedAt time.Time `json:"updated_at"`
}
type UpsertChannelConfigRequest struct {
Settings map[string]any `json:"settings"`
Enabled *bool `json:"enabled"`
}
type SendSMSRequest struct {
To string `json:"to" binding:"required"`
Message string `json:"message" binding:"required"`
}
type SendEmailRequest struct {
To string `json:"to" binding:"required"`
Subject string `json:"subject"`
BodyHTML string `json:"body_html"`
BodyText string `json:"body_text"`
TemplateCode string `json:"template_code"`
Locale string `json:"locale"`
Variables map[string]string `json:"variables"`
}