Files
GL.iNet-Yongping.Xie 9459b4709c feat: add email notification for device events
- SMTP config with TLS/STARTTLS/plain support and test email
- Notification rules for device online, offline, and remote access
- Recipient management with add/remove endpoints
- Async email sending via goroutines to avoid blocking device runtime
- Admin settings page with SMTP, rules, and recipients sections
- Bell icon added to sidebar menu
- i18n support for all 7 languages

Signed-off-by: GL.iNet-Yongping.Xie <yongping.xie@gl-inet.com>
2026-04-07 21:02:24 -07:00

62 lines
2.0 KiB
Go

package dto
// ─── SMTP Config ────────────────────────────────────────────────
type SMTPConfigReq struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
FromEmail string `json:"fromEmail"`
Encryption string `json:"encryption"`
Enabled bool `json:"enabled"`
}
type SMTPConfigResp struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
FromEmail string `json:"fromEmail"`
Encryption string `json:"encryption"`
Enabled bool `json:"enabled"`
UpdatedAt int64 `json:"updatedAt"`
}
// ─── SMTP Test ──────────────────────────────────────────────────
type SMTPTestReq struct {
Email string `json:"email" binding:"required"`
}
// ─── Notify Rules ───────────────────────────────────────────────
type NotifyRulesReq struct {
DeviceOnline bool `json:"deviceOnline"`
DeviceOffline bool `json:"deviceOffline"`
RemoteAccess bool `json:"remoteAccess"`
}
type NotifyRulesResp struct {
DeviceOnline bool `json:"deviceOnline"`
DeviceOffline bool `json:"deviceOffline"`
RemoteAccess bool `json:"remoteAccess"`
UpdatedAt int64 `json:"updatedAt"`
}
// ─── Recipients ─────────────────────────────────────────────────
type AddRecipientReq struct {
Email string `json:"email" binding:"required"`
}
type RecipientResp struct {
ID int64 `json:"id"`
Email string `json:"email"`
CreatedAt int64 `json:"createdAt"`
}
type ListRecipientsResp struct {
Items []RecipientResp `json:"items"`
}