aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 03:06:23 +0530
committerBobby <[email protected]>2026-03-08 03:06:23 +0530
commitcaf265e7050edefa64ecf7e13828ec9636bce867 (patch)
tree6bb8554dbb34695a74c2dca556bf512998cf62ab /models
parentcca905d35412f1549400fc3d1aca6dc704d8cae6 (diff)
downloaddove-caf265e7050edefa64ecf7e13828ec9636bce867.tar.xz
dove-caf265e7050edefa64ecf7e13828ec9636bce867.zip
Refactor configuration handling and add mail management features
- Removed dependency on messages package in TOML loading and parsing. - Introduced new config constants and messages for better clarity and maintainability. - Implemented mail user and mailbox management with corresponding controllers and views. - Added new templates for mailboxes, mailbox creation, and user management. - Enhanced logging and error handling throughout the application. - Established a structured approach for applying default values in TOML configuration. - Created new utility functions for SMTP and email handling.
Diffstat (limited to 'models')
-rw-r--r--models/alias.go10
-rw-r--r--models/attachment.go14
-rw-r--r--models/email.go25
-rw-r--r--models/mailbox.go12
-rw-r--r--models/tag.go9
-rw-r--r--models/user.go10
6 files changed, 0 insertions, 80 deletions
diff --git a/models/alias.go b/models/alias.go
deleted file mode 100644
index 5b0dcb3..0000000
--- a/models/alias.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package models
-
-import "gorm.io/gorm"
-
-type Alias struct {
- gorm.Model
- SourceAddress string `gorm:"uniqueIndex;not null" json:"source_address"`
- MailboxID uint `gorm:"not null" json:"mailbox_id"`
- Mailbox Mailbox `gorm:"foreignKey:MailboxID" json:"mailbox"`
-}
diff --git a/models/attachment.go b/models/attachment.go
deleted file mode 100644
index cd1a741..0000000
--- a/models/attachment.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package models
-
-import "gorm.io/gorm"
-
-type Attachment struct {
- gorm.Model
- EmailID uint `gorm:"not null;index" json:"email_id"`
- Email Email `gorm:"foreignKey:EmailID" json:"email"`
- Filename string `gorm:"not null" json:"filename"`
- ContentType string `gorm:"not null" json:"content_type"`
- ContentID string `json:"content_id"`
- Size int64 `json:"size"`
- IsInline bool `gorm:"default:false" json:"is_inline"`
-}
diff --git a/models/email.go b/models/email.go
deleted file mode 100644
index 12b3ad1..0000000
--- a/models/email.go
+++ /dev/null
@@ -1,25 +0,0 @@
-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"`
-}
diff --git a/models/mailbox.go b/models/mailbox.go
deleted file mode 100644
index da4114f..0000000
--- a/models/mailbox.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package models
-
-import "gorm.io/gorm"
-
-type Mailbox struct {
- gorm.Model
- Address string `gorm:"uniqueIndex;not null" json:"address"`
- UserID uint `gorm:"not null" json:"user_id"`
- User User `gorm:"foreignKey:UserID" json:"user"`
- Aliases []Alias `gorm:"foreignKey:MailboxID" json:"aliases"`
- Emails []Email `gorm:"foreignKey:MailboxID" json:"emails"`
-}
diff --git a/models/tag.go b/models/tag.go
deleted file mode 100644
index 79fa65f..0000000
--- a/models/tag.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package models
-
-import "gorm.io/gorm"
-
-type Tag struct {
- gorm.Model
- Name string `gorm:"uniqueIndex;not null" json:"name"`
- Emails []Email `gorm:"many2many:email_tags" json:"emails"`
-}
diff --git a/models/user.go b/models/user.go
deleted file mode 100644
index 6bb6edf..0000000
--- a/models/user.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package models
-
-import "gorm.io/gorm"
-
-type User struct {
- gorm.Model
- Username string `gorm:"uniqueIndex;not null" json:"username"`
- DisplayName string `json:"display_name"`
- Mailboxes []Mailbox `gorm:"foreignKey:UserID" json:"mailboxes"`
-}