51 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package dto
 | |
| 
 | |
| import (
 | |
| 	"time"
 | |
| 
 | |
| 	"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
 | |
| 	"git.huangwc.com/pig/pig-farm-controller/internal/infra/notify"
 | |
| 	"go.uber.org/zap/zapcore"
 | |
| )
 | |
| 
 | |
| // SendTestNotificationRequest 定义了发送测试通知请求的 JSON 结构
 | |
| type SendTestNotificationRequest struct {
 | |
| 	// Type 指定要测试的通知渠道
 | |
| 	Type notify.NotifierType `json:"type" validate:"required"`
 | |
| }
 | |
| 
 | |
| // ListNotificationRequest 定义了获取通知列表的请求参数
 | |
| type ListNotificationRequest struct {
 | |
| 	Page         int                        `query:"page"`
 | |
| 	PageSize     int                        `query:"pageSize"`
 | |
| 	UserID       *uint                      `query:"user_id"`
 | |
| 	NotifierType *notify.NotifierType       `query:"notifier_type"`
 | |
| 	Status       *models.NotificationStatus `query:"status"`
 | |
| 	Level        *zapcore.Level             `query:"level"`
 | |
| 	StartTime    *time.Time                 `query:"start_time"`
 | |
| 	EndTime      *time.Time                 `query:"end_time"`
 | |
| 	OrderBy      string                     `query:"order_by"`
 | |
| }
 | |
| 
 | |
| // NotificationDTO 是用于API响应的通知结构
 | |
| type NotificationDTO struct {
 | |
| 	ID             uint                      `json:"id"`
 | |
| 	CreatedAt      time.Time                 `json:"created_at"`
 | |
| 	UpdatedAt      time.Time                 `json:"updated_at"`
 | |
| 	NotifierType   notify.NotifierType       `json:"notifier_type"`
 | |
| 	UserID         uint                      `json:"user_id"`
 | |
| 	Title          string                    `json:"title"`
 | |
| 	Message        string                    `json:"message"`
 | |
| 	Level          zapcore.Level             `json:"level"`
 | |
| 	AlarmTimestamp time.Time                 `json:"alarm_timestamp"`
 | |
| 	ToAddress      string                    `json:"to_address"`
 | |
| 	Status         models.NotificationStatus `json:"status"`
 | |
| 	ErrorMessage   string                    `json:"error_message"`
 | |
| }
 | |
| 
 | |
| // ListNotificationResponse 是获取通知列表的响应结构
 | |
| type ListNotificationResponse struct {
 | |
| 	List       []NotificationDTO `json:"list"`
 | |
| 	Pagination PaginationDTO     `json:"pagination"`
 | |
| }
 |