From b2a231280ce3265d20cdc5f317ae1bcc5eb59924 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sun, 8 Mar 2026 08:11:41 +0530 Subject: Add webmail email management templates and storage utilities - Implemented email listing template with read/unread and star functionality. - Created empty state template for webmail when no emails are present. - Developed folder navigation template for managing email folders. - Added email preview template for displaying selected email details. - Introduced storage utilities for managing email files, including creation, reading, moving, and deletion. - Defined constants for storage paths and error messages related to file operations. --- models/mail/email.go | 3 +++ models/mail/folder.go | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 models/mail/folder.go (limited to 'models') diff --git a/models/mail/email.go b/models/mail/email.go index 4b8b55e..b0cc27e 100644 --- a/models/mail/email.go +++ b/models/mail/email.go @@ -6,6 +6,9 @@ type Email struct { gorm.Model MailboxID uint `gorm:"not null;index" json:"mailbox_id"` Mailbox Mailbox `gorm:"foreignKey:MailboxID" json:"mailbox"` + FolderID uint `gorm:"not null;index" json:"folder_id"` + Folder Folder `gorm:"foreignKey:FolderID" json:"folder"` + IsStarred bool `gorm:"default:false;index" json:"is_starred"` MessageID string `gorm:"index" json:"message_id"` Filename string `gorm:"uniqueIndex;not null" json:"filename"` FromAddress string `gorm:"not null" json:"from_address"` diff --git a/models/mail/folder.go b/models/mail/folder.go new file mode 100644 index 0000000..3c46bec --- /dev/null +++ b/models/mail/folder.go @@ -0,0 +1,13 @@ +package mail + +import "gorm.io/gorm" + +type Folder struct { + gorm.Model + Name string `gorm:"not null" json:"name"` + Slug string `gorm:"not null;index" json:"slug"` + MailboxID uint `gorm:"not null;index" json:"mailbox_id"` + Mailbox Mailbox `gorm:"foreignKey:MailboxID" json:"mailbox"` + IsSystem bool `gorm:"not null;default:false" json:"is_system"` + Position int `gorm:"not null;default:0" json:"position"` +} -- cgit v1.2.3