|
|
- package Models
-
- import (
- "time"
-
- "github.com/gofrs/uuid"
- )
-
- // ConversationDetail stores the name for the conversation
- type ConversationDetail struct {
- Base
- Name string `gorm:"not null" json:"name"` // Stored encrypted
- Users []ConversationDetailUser ` json:"users"`
- TwoUser string `gorm:"not null" json:"two_user"`
- AttachmentID *uuid.UUID ` json:"attachment_id"`
- Attachment Attachment ` json:"attachment"`
- MessageExpiryDefault MessageExpiry `gorm:"default:no_expiry" json:"-" sql:"type:ENUM('fifteen_min', 'thirty_min', 'one_hour', 'three_hour', 'six_hour', 'twelve_hour', 'one_day', 'three_day', 'no_expiry')"` // Stored encrypted
- MessageExpiry string `gorm:"-" json:"message_expiry"` // Stored encrypted
- AdminAddMembers string ` json:"admin_add_members"` // Stored encrypted
- AdminEditInfo string ` json:"admin_edit_info"` // Stored encrypted
- AdminSendMessages string ` json:"admin_send_messages"` // Stored encrypted
- }
-
- // ConversationDetailUser all users associated with a conversation
- type ConversationDetailUser struct {
- Base
- ConversationDetailID uuid.UUID `gorm:"not null" json:"conversation_detail_id"`
- ConversationDetail ConversationDetail `gorm:"not null" json:"conversation"`
- UserID string `gorm:"not null" json:"user_id"` // Stored encrypted
- Username string `gorm:"not null" json:"username"` // Stored encrypted
- Admin string `gorm:"not null" json:"admin"` // Stored encrypted
- AssociationKey string `gorm:"not null" json:"association_key"` // Stored encrypted
- PublicKey string `gorm:"not null" json:"public_key"` // Stored encrypted
- }
-
- // UserConversation Used to link the current user to their conversations
- 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
- 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
- CreatedAt time.Time `gorm:"not null" json:"created_at"`
- }
|