Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
2.0 KiB

  1. package Models
  2. import (
  3. "github.com/gofrs/uuid"
  4. )
  5. // ConversationDetail stores the name for the conversation
  6. type ConversationDetail struct {
  7. Base
  8. Name string `gorm:"not null" json:"name"` // Stored encrypted
  9. Users []ConversationDetailUser ` json:"users"`
  10. TwoUser string `gorm:"not null" json:"two_user"`
  11. AttachmentID *uuid.UUID ` json:"attachment_id"`
  12. Attachment Attachment ` json:"attachment"`
  13. }
  14. // ConversationDetailUser all users associated with a customer
  15. type ConversationDetailUser struct {
  16. Base
  17. ConversationDetailID uuid.UUID `gorm:"not null" json:"conversation_detail_id"`
  18. ConversationDetail ConversationDetail `gorm:"not null" json:"conversation"`
  19. UserID string `gorm:"not null" json:"user_id"` // Stored encrypted
  20. Username string `gorm:"not null" json:"username"` // Stored encrypted
  21. Admin string `gorm:"not null" json:"admin"` // Stored encrypted
  22. AssociationKey string `gorm:"not null" json:"association_key"` // Stored encrypted
  23. PublicKey string `gorm:"not null" json:"public_key"` // Stored encrypted
  24. }
  25. // UserConversation Used to link the current user to their conversations
  26. type UserConversation struct {
  27. Base
  28. UserID uuid.UUID `gorm:"type:uuid;column:user_id;not null;" json:"user_id"`
  29. User User ` json:"user"`
  30. ConversationDetailID string `gorm:"not null" json:"conversation_detail_id"` // Stored encrypted
  31. Admin string `gorm:"not null" json:"admin"` // Bool if user is admin of thread, stored encrypted
  32. SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
  33. }