RezinaLMS-BackEnd/internal/domain/scheduled_notification.go
Yared Yemane 7836a9f95d feat: wire email templates for outbound, welcome, and password reset flows
Enable template selection on admin single/bulk and scheduled emails, send welcome emails only after email registration OTP verification, and use the password_reset template for email-based reset links.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-15 05:17:01 -07:00

63 lines
2.0 KiB
Go

package domain
import (
"encoding/json"
"time"
)
type ScheduledNotificationStatus string
const (
ScheduledStatusPending ScheduledNotificationStatus = "pending"
ScheduledStatusProcessing ScheduledNotificationStatus = "processing"
ScheduledStatusSent ScheduledNotificationStatus = "sent"
ScheduledStatusFailed ScheduledNotificationStatus = "failed"
ScheduledStatusCancelled ScheduledNotificationStatus = "cancelled"
)
type ScheduledNotificationTargetRaw struct {
Phones []string `json:"phones,omitempty"`
Emails []string `json:"emails,omitempty"`
// In-app scheduled notifications may store optional metadata here.
Level string `json:"level,omitempty"`
Type string `json:"type,omitempty"`
}
type ScheduledNotification struct {
ID int64 `json:"id"`
Channel DeliveryChannel `json:"channel"`
Title string `json:"title,omitempty"`
Message string `json:"message"`
HTML string `json:"html,omitempty"`
EmailTemplateSlug string `json:"email_template_slug,omitempty"`
EmailTemplateVariables json.RawMessage `json:"email_template_variables,omitempty"`
ScheduledAt time.Time `json:"scheduled_at"`
Status ScheduledNotificationStatus `json:"status"`
TargetUserIDs []int64 `json:"target_user_ids,omitempty"`
TargetRole string `json:"target_role,omitempty"`
TargetRaw json.RawMessage `json:"target_raw,omitempty"`
AttemptCount int32 `json:"attempt_count"`
LastError string `json:"last_error,omitempty"`
ProcessingStartedAt *time.Time `json:"processing_started_at,omitempty"`
SentAt *time.Time `json:"sent_at,omitempty"`
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
CreatedBy int64 `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ScheduledNotificationFilter struct {
Status string
Channel string
After *time.Time
Before *time.Time
Limit int
Offset int
}