message_personal.go 1.5 KB
package domain

import "time"

// MessagePersonal 个人的消息提示
type MessagePersonal struct {
	Id           int             `json:"id"`           //
	Types        MessageTypes    `json:"types"`        //消息类型
	TargetUserId int             `json:"targetUserId"` //消息指向的用户
	ReadFlag     MessageReadFlag `json:"readFlag"`     //1:已读、2:未读
	Title        string          `json:"title"`        //消息的标题
	Content      string          `json:"content"`      //消息的内容
	CreatedAt    time.Time       `json:"createdAt"`    //
	UpdatedAt    time.Time       `json:"updatedAt"`    //
	Payload      string          `json:"payload"`      //消息的额外承载的数据
}

// 个人的消息提示类型
type MessageTypes string

const (
	MessageTypesOther        MessageTypes = "other"          //综合自评开启时,消息通知
	MessageTypesTaskStage    MessageTypes = "task_stage"     //任务里程碑未按时完成
	MessageTypesTaskRecord   MessageTypes = "task_record"    //任务每日反馈异常
	MessageTypesTaskModify   MessageTypes = "task_modify"    //修改任务
	MessageTypesTaskStageApp MessageTypes = "task_stage-app" //任务里程碑未按时完成
)

type MessageReadFlag string

const (
	MessageIsRead MessageReadFlag = "read"
	MessageUnread MessageReadFlag = "unread"
)

type MessagePersonalRepository interface {
	Save(param *MessagePersonal) error
	Find(queryOptions map[string]interface{}) (int, []*MessagePersonal, error)
}