notification.go
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package domain
import "time"
const (
NOTIFICATION_TYPE_SYSTEM = iota + 1 //系统通知
NOTIFICATION_TYPE_INTERACTION //互动通知
)
const (
EXTERNAL_RESOURCE_TYPE_TASK = iota + 1 //任务
EXTERNAL_RESOURCE_TYPE_REJECT_TASK_RECORD //驳回任务记录
)
// 通知
type Notification struct {
// 通知ID
NotificationId int64 `json:"notificationId"`
// 通知类型
NotificationType int `json:"notificationType"`
// 通知标题
NotificationTitle string `json:"notificationTitle"`
// 通知内容
NotificationContent string `json:"notificationContent"`
// 通知时间
NotificationTime time.Time `json:"notificationTime"`
// 外部资源引用类型(1任务2驳回任务记录)
ExternalResourceType int `json:"externalResourceType"`
// 外部资源引用
ExternalResource int64 `json:"externalResource"`
}
type NotificationRepository interface {
Save(notification *Notification) (*Notification, error)
Remove(notification *Notification) (*Notification, error)
FindOne(queryOptions map[string]interface{}) (*Notification, error)
Find(queryOptions map[string]interface{}) (int64, []*Notification, error)
}
func (notification *Notification) Identify() interface{} {
if notification.NotificationId == 0 {
return nil
}
return notification.NotificationId
}