backend/pkg/notification/domain/repository/history.go

37 lines
1.3 KiB
Go
Raw Permalink Normal View History

2025-10-02 16:36:34 +00:00
package repository
import (
"backend/pkg/notification/domain/entity"
"context"
)
// HistoryRepository 傳送歷史記錄接口
type HistoryRepository interface {
// CreateHistory 創建歷史記錄
CreateHistory(ctx context.Context, history *entity.DeliveryHistory) error
// UpdateHistory 更新歷史記錄
UpdateHistory(ctx context.Context, history *entity.DeliveryHistory) error
// GetHistory 根據ID獲取歷史記錄
GetHistory(ctx context.Context, id string) (*entity.DeliveryHistory, error)
// ListHistory 列出歷史記錄
ListHistory(ctx context.Context, filter HistoryFilter) ([]*entity.DeliveryHistory, error)
// AddAttempt 添加發送嘗試記錄
AddAttempt(ctx context.Context, historyID string, attempt entity.DeliveryAttempt) error
}
// HistoryFilter 歷史記錄查詢過濾器
type HistoryFilter struct {
Type string `json:"type"` // email/sms
Recipient string `json:"recipient"` // 收件人
Status entity.DeliveryStatus `json:"status"` // 狀態
Provider string `json:"provider"` // 提供商
StartTime *int64 `json:"start_time"` // 開始時間
EndTime *int64 `json:"end_time"` // 結束時間
Limit int `json:"limit"` // 限制數量
Offset int `json:"offset"` // 偏移量
}