Files
pig-farm-controller/internal/app/dto/notification_dto.go

51 lines
2.1 KiB
Go
Raw Permalink Normal View History

package dto
2025-10-25 15:04:47 +08:00
import (
"time"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
2025-11-05 19:57:30 +08:00
2025-10-25 15:04:47 +08:00
"go.uber.org/zap/zapcore"
)
// SendTestNotificationRequest 定义了发送测试通知请求的 JSON 结构
type SendTestNotificationRequest struct {
// Type 指定要测试的通知渠道
Type models.NotifierType `json:"type" validate:"required"`
}
2025-10-25 15:04:47 +08:00
// ListNotificationRequest 定义了获取通知列表的请求参数
type ListNotificationRequest struct {
2025-10-31 18:14:12 +08:00
Page int `json:"page" query:"page"`
PageSize int `json:"page_size" query:"page_size"`
2025-11-10 22:23:31 +08:00
UserID *uint32 `json:"user_id" query:"user_id"`
NotifierType *models.NotifierType `json:"notifier_type" query:"notifier_type"`
2025-10-31 18:14:12 +08:00
Status *models.NotificationStatus `json:"status" query:"status"`
Level *zapcore.Level `json:"level" query:"level"`
StartTime *time.Time `json:"start_time" query:"start_time"`
EndTime *time.Time `json:"end_time" query:"end_time"`
OrderBy string `json:"order_by" query:"order_by"`
2025-10-25 15:04:47 +08:00
}
// NotificationDTO 是用于API响应的通知结构
type NotificationDTO struct {
2025-11-10 22:23:31 +08:00
ID uint32 `json:"id"`
2025-10-25 15:04:47 +08:00
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
NotifierType models.NotifierType `json:"notifier_type"`
2025-11-10 22:23:31 +08:00
UserID uint32 `json:"user_id"`
2025-10-25 15:04:47 +08:00
Title string `json:"title"`
Message string `json:"message"`
Level models.SeverityLevel `json:"level"`
2025-10-25 15:04:47 +08:00
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"`
}