2024-03-30 17:10:36 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
import "gorm.io/datatypes"
|
|
|
|
|
|
|
|
type MessageType = uint8
|
|
|
|
|
|
|
|
const (
|
|
|
|
MessageTypeText = MessageType(iota)
|
|
|
|
MessageTypeAudio
|
|
|
|
)
|
|
|
|
|
|
|
|
type Message struct {
|
|
|
|
BaseModel
|
|
|
|
|
2024-03-30 18:21:17 +08:00
|
|
|
Content string `json:"content"`
|
|
|
|
Metadata datatypes.JSONMap `json:"metadata"`
|
|
|
|
Type MessageType `json:"type"`
|
|
|
|
Attachments []Attachment `json:"attachments"`
|
2024-03-30 18:40:21 +08:00
|
|
|
Channel Channel `json:"channel"`
|
2024-03-30 22:33:20 +08:00
|
|
|
Sender ChannelMember `json:"sender"`
|
2024-03-31 21:19:51 +08:00
|
|
|
ReplyID *uint `json:"reply_id"`
|
|
|
|
ReplyTo *Message `json:"reply_to" gorm:"foreignKey:ReplyID"`
|
2024-03-30 18:21:17 +08:00
|
|
|
ChannelID uint `json:"channel_id"`
|
|
|
|
SenderID uint `json:"sender_id"`
|
2024-03-30 17:10:36 +08:00
|
|
|
}
|