22 lines
800 B
Go
22 lines
800 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// MessageReaction represents a reaction on a message.
|
|
// Reference: P2B M3 spec
|
|
type MessageReaction struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
MessageID uint `gorm:"not null;index" json:"message_id"`
|
|
ContactID *uint `gorm:"index" json:"contact_id,omitempty"`
|
|
UserID *uint `gorm:"index" json:"user_id,omitempty"`
|
|
Emoji string `gorm:"size:50;not null" json:"emoji"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
|
|
Message Message `gorm:"foreignKey:MessageID" json:"message,omitempty"`
|
|
Contact *Contact `gorm:"foreignKey:ContactID" json:"contact,omitempty"`
|
|
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
|
}
|
|
|
|
func (MessageReaction) TableName() string { return "message_reactions" } |