Messaging/pkg/models/messages.go

23 lines
709 B
Go
Raw Normal View History

2024-03-30 09:10:36 +00:00
package models
2024-05-26 15:01:20 +00:00
import "gorm.io/datatypes"
2024-06-08 12:38:03 +00:00
const (
MessageTextType = "m.text"
)
2024-03-30 09:10:36 +00:00
type Message struct {
BaseModel
2024-05-26 15:01:20 +00:00
Uuid string `json:"uuid"`
Content datatypes.JSONMap `json:"content"`
Type string `json:"type"`
Attachments datatypes.JSONSlice[uint] `json:"attachments"`
Channel Channel `json:"channel"`
Sender ChannelMember `json:"sender"`
ReplyID *uint `json:"reply_id"`
ReplyTo *Message `json:"reply_to" gorm:"foreignKey:ReplyID"`
ChannelID uint `json:"channel_id"`
SenderID uint `json:"sender_id"`
2024-03-30 09:10:36 +00:00
}