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.

35 lines
1.8 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. }
  12. // ConversationDetailUser all users associated with a customer
  13. type ConversationDetailUser struct {
  14. Base
  15. ConversationDetailID uuid.UUID `gorm:"not null" json:"conversation_detail_id"`
  16. ConversationDetail ConversationDetail `gorm:"not null" json:"conversation"`
  17. UserID string `gorm:"not null" json:"user_id"` // Stored encrypted
  18. Username string `gorm:"not null" json:"username"` // Stored encrypted
  19. Admin string `gorm:"not null" json:"admin"` // Stored encrypted
  20. AssociationKey string `gorm:"not null" json:"association_key"` // Stored encrypted
  21. PublicKey string `gorm:"not null" json:"public_key"` // Stored encrypted
  22. }
  23. // UserConversation Used to link the current user to their conversations
  24. type UserConversation struct {
  25. Base
  26. UserID uuid.UUID `gorm:"type:uuid;column:user_id;not null;" json:"user_id"`
  27. User User ` json:"user"`
  28. ConversationDetailID string `gorm:"not null" json:"conversation_detail_id"` // Stored encrypted
  29. Admin string `gorm:"not null" json:"admin"` // Bool if user is admin of thread, stored encrypted
  30. SymmetricKey string `gorm:"not null" json:"symmetric_key"` // Stored encrypted
  31. }