aboutsummaryrefslogtreecommitdiff
path: root/models/email.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/email.go')
-rw-r--r--models/email.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/models/email.go b/models/email.go
new file mode 100644
index 0000000..12b3ad1
--- /dev/null
+++ b/models/email.go
@@ -0,0 +1,25 @@
+package models
+
+import "gorm.io/gorm"
+
+type Email struct {
+ gorm.Model
+ MailboxID uint `gorm:"not null;index" json:"mailbox_id"`
+ Mailbox Mailbox `gorm:"foreignKey:MailboxID" json:"mailbox"`
+ MessageID string `gorm:"index" json:"message_id"`
+ Filename string `gorm:"uniqueIndex;not null" json:"filename"`
+ FromAddress string `gorm:"not null" json:"from_address"`
+ FromName string `json:"from_name"`
+ ToAddresses string `gorm:"not null" json:"to_addresses"`
+ CcAddresses string `json:"cc_addresses"`
+ BccAddresses string `json:"bcc_addresses"`
+ ReplyToAddress string `json:"reply_to_address"`
+ ReturnPath string `json:"return_path"`
+ Subject string `json:"subject"`
+ Snippet string `json:"snippet"`
+ Size int64 `json:"size"`
+ IsRead bool `gorm:"default:false;index" json:"is_read"`
+ AttachmentCount int `gorm:"default:0" json:"attachment_count"`
+ InlineCount int `gorm:"default:0" json:"inline_count"`
+ Tags []Tag `gorm:"many2many:email_tags" json:"tags"`
+}