37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
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"` // 偏移量
|
|
}
|