package Models
|
|
|
|
import "github.com/gofrs/uuid"
|
|
|
|
const (
|
|
MessageTypeSender = "sender"
|
|
MessageTypeReceiver = "reciever"
|
|
)
|
|
|
|
type MessageData struct {
|
|
Base
|
|
Data []byte `gorm:"not null" json:"data"` // Stored encrypted
|
|
}
|
|
|
|
// TODO: Rename this to something better
|
|
type Message struct {
|
|
Base
|
|
ThreadID uuid.UUID `gorm:"not null" json:"thread_id"`
|
|
UserID uuid.UUID `json:"-"`
|
|
User User `json:"user"`
|
|
MessageDataID uuid.UUID `json:"-"`
|
|
MessageData MessageData `json:"message_data"`
|
|
MessageType string `gorm:"not null" json:"message_type"` // sender / reciever
|
|
RelationalUserId []byte `gorm:"not null" json:"relational_user_id"` // Stored encrypted. UserID for the user this message is in relation to
|
|
SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
|
|
}
|