🗃️ Add relations between related event and original event

This commit is contained in:
2024-11-18 23:28:17 +08:00
parent 6c60e250e1
commit c642f5ee44
3 changed files with 43 additions and 38 deletions

View File

@@ -15,24 +15,26 @@ const (
type Event struct {
cruda.BaseModel
Uuid string `json:"uuid"`
Body datatypes.JSONMap `json:"body"`
Type string `json:"type"`
Channel Channel `json:"channel"`
Sender ChannelMember `json:"sender"`
QuoteEventID *uint `json:"quote_event_id,omitempty"`
QuoteEvent *Event `json:"quote_event,omitempty" gorm:"foreignKey:QuoteEventID"`
ChannelID uint `json:"channel_id"`
SenderID uint `json:"sender_id"`
Uuid string `json:"uuid"`
Body datatypes.JSONMap `json:"body"`
Type string `json:"type"`
Channel Channel `json:"channel"`
Sender ChannelMember `json:"sender"`
QuoteEventID *uint `json:"quote_event_id,omitempty"`
QuoteEvent *Event `json:"quote_event,omitempty" gorm:"foreignKey:QuoteEventID"`
RelatedEventID *uint `json:"related_event_id,omitempty"`
RelatedEvent *Event `json:"related_event,omitempty" gorm:"foreignKey:RelatedEventID"`
ChannelID uint `json:"channel_id"`
SenderID uint `json:"sender_id"`
}
// Event Payloads
type EventMessageBody struct {
Text string `json:"text,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Attachments []string `json:"attachments,omitempty"`
QuoteEventID *uint `json:"quote_event,omitempty"`
RelatedEvent *uint `json:"related_event,omitempty"`
RelatedUsers []uint `json:"related_users,omitempty"`
Text string `json:"text,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Attachments []string `json:"attachments,omitempty"`
QuoteEventID *uint `json:"quote_event,omitempty"`
RelatedEventID *uint `json:"related_event,omitempty"`
RelatedUsers []uint `json:"related_users,omitempty"`
}