From 17b250cd4722ba281343b35b85fb645ffefedcf8 Mon Sep 17 00:00:00 2001 From: Bobby <30593201+luciferreeves@users.noreply.github.com> Date: Tue, 23 Dec 2025 18:36:26 +0530 Subject: email model and syncing and showing emails --- models/email.go | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 models/email.go (limited to 'models') diff --git a/models/email.go b/models/email.go new file mode 100644 index 0000000..84474b7 --- /dev/null +++ b/models/email.go @@ -0,0 +1,53 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +type Email struct { + gorm.Model + UserEmail string + FolderID uint + Folder Folder `gorm:"foreignKey:FolderID"` + + UID uint32 `gorm:"index"` + MessageID string `gorm:"index"` + + From string + FromName string + To string + CC string + BCC string + ReplyTo string + + Subject string + Date time.Time `gorm:"index"` + + BodyText string `gorm:"type:text"` + BodyHTML string `gorm:"type:text"` + Snippet string + + IsRead bool `gorm:"default:false;index"` + IsFlagged bool `gorm:"default:false;index"` + IsAnswered bool `gorm:"default:false"` + IsDraft bool `gorm:"default:false"` + HasAttachment bool `gorm:"default:false;index"` + + Size int64 + InReplyTo string + References string +} + +type Attachment struct { + gorm.Model + EmailID uint + Email Email `gorm:"foreignKey:EmailID"` + + Filename string + ContentType string + Size int64 + ContentID string + MinIOPath string `gorm:"index"` +} -- cgit v1.2.3