|
|
- package Models
-
- import (
- "time"
-
- "github.com/gofrs/uuid"
- )
-
- // TODO: Add support for images
- type MessageData struct {
- Base
- Data string `gorm:"not null" json:"data"` // Stored encrypted
- SenderID string `gorm:"not null" json:"sender_id"`
- }
-
- type Message struct {
- Base
- MessageDataID uuid.UUID `json:"-"`
- MessageData MessageData `json:"message_data"`
- SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
- MessageThreadKey string `gorm:"not null" json:"message_thread_key"`
- CreatedAt time.Time `gorm:"not null" json:"created_at"`
- }
-
- // TODO: Rename to ConversationDetails
- type ConversationDetail struct {
- Base
- Name string `gorm:"not null" json:"name"`
- Users string `json:"users"` // Stored as encrypted JSON
- }
-
- type UserConversation struct {
- Base
- UserID uuid.UUID `gorm:"type:uuid;column:user_id;not null;" json:"user_id"`
- User User `json:"user"`
- ConversationDetailID string `gorm:"not null" json:"conversation_detail_id"` // Stored encrypted
- MessageThreadKey string `gorm:"not null" json:"message_thread_key"` // Stored encrypted
- Admin string `gorm:"not null" json:"admin"` // Bool if user is admin of thread, stored encrypted
- SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
- }
|