57 lines
1.7 KiB
Go
57 lines
1.7 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"`
|
|
}
|
|
|
|
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"`
|
|
|
|
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
|
|
}
|