aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 02:27:15 +0530
committerBobby <[email protected]>2026-03-08 02:27:15 +0530
commitcca905d35412f1549400fc3d1aca6dc704d8cae6 (patch)
tree0c0231f5c2ebaeb7700e08a2c1f07373d3251658 /models
parent547384c41181c034a5eaf340c5e569d36eb013be (diff)
downloaddove-cca905d35412f1549400fc3d1aca6dc704d8cae6.tar.xz
dove-cca905d35412f1549400fc3d1aca6dc704d8cae6.zip
feat(domains): add new TLD creation page and update sidebar
- Introduced a new HTMX template for creating TLDs. - Created a new Django template for the new TLD page. - Updated the sidebar to include a link to the domains section. refactor(types): remove unused types and consolidate request handling - Deleted unused type definitions related to authentication, errors, mailboxes, overview, requests, responses, and users. - Introduced a new collections package for generic data structures. - Refactored request handling to use a more streamlined approach with RequestInfo and Param types. fix(meta): improve pagination and sorting functionality - Updated pagination logic to handle default values and edge cases. - Introduced a new Sorting type for better sorting management in queries. chore(urls): refactor URL handling and registry - Replaced enums with string constants for HTTP methods. - Consolidated route registration logic and improved type safety with RegisteredRoute. style(shortcuts): clean up error handling and rendering functions - Enhanced error handling functions for better readability and maintainability. - Removed deprecated functions and improved the structure of rendering logic.
Diffstat (limited to 'models')
-rw-r--r--models/domain/domain.go10
-rw-r--r--models/domain/tld.go10
-rw-r--r--models/mail/alias.go10
-rw-r--r--models/mail/attachment.go14
-rw-r--r--models/mail/email.go25
-rw-r--r--models/mail/mailbox.go12
-rw-r--r--models/mail/tag.go9
-rw-r--r--models/mail/user.go10
8 files changed, 100 insertions, 0 deletions
diff --git a/models/domain/domain.go b/models/domain/domain.go
new file mode 100644
index 0000000..9a1a0ef
--- /dev/null
+++ b/models/domain/domain.go
@@ -0,0 +1,10 @@
+package domain
+
+import "gorm.io/gorm"
+
+type Domain struct {
+ gorm.Model
+ Name string `gorm:"not null;uniqueIndex:idx_domain_tld" json:"name"`
+ TLDID uint `gorm:"not null;uniqueIndex:idx_domain_tld" json:"tld_id"`
+ TLD TLD `gorm:"foreignKey:TLDID" json:"tld"`
+}
diff --git a/models/domain/tld.go b/models/domain/tld.go
new file mode 100644
index 0000000..5a47f32
--- /dev/null
+++ b/models/domain/tld.go
@@ -0,0 +1,10 @@
+package domain
+
+import "gorm.io/gorm"
+
+type TLD struct {
+ gorm.Model
+ Name string `gorm:"uniqueIndex;not null" json:"name"`
+ IsDefault bool `gorm:"default:false" json:"is_default"`
+ Domains []Domain `gorm:"foreignKey:TLDID" json:"domains"`
+}
diff --git a/models/mail/alias.go b/models/mail/alias.go
new file mode 100644
index 0000000..c2cd752
--- /dev/null
+++ b/models/mail/alias.go
@@ -0,0 +1,10 @@
+package mail
+
+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/mail/attachment.go b/models/mail/attachment.go
new file mode 100644
index 0000000..fcff37e
--- /dev/null
+++ b/models/mail/attachment.go
@@ -0,0 +1,14 @@
+package mail
+
+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/mail/email.go b/models/mail/email.go
new file mode 100644
index 0000000..4b8b55e
--- /dev/null
+++ b/models/mail/email.go
@@ -0,0 +1,25 @@
+package mail
+
+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/mail/mailbox.go b/models/mail/mailbox.go
new file mode 100644
index 0000000..62e3f1d
--- /dev/null
+++ b/models/mail/mailbox.go
@@ -0,0 +1,12 @@
+package mail
+
+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/mail/tag.go b/models/mail/tag.go
new file mode 100644
index 0000000..65d2bd3
--- /dev/null
+++ b/models/mail/tag.go
@@ -0,0 +1,9 @@
+package mail
+
+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/mail/user.go b/models/mail/user.go
new file mode 100644
index 0000000..68241f6
--- /dev/null
+++ b/models/mail/user.go
@@ -0,0 +1,10 @@
+package mail
+
+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"`
+}