diff options
| author | Bobby <[email protected]> | 2026-03-07 18:42:40 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-07 18:42:40 +0530 |
| commit | 96c136f046d78c51210927e61483a36a220fedcb (patch) | |
| tree | 8f5baf294d92ec3bc503bd02f4a08871874f048d /pages | |
| parent | 6bc2ef7a8972547f10a5a8f50269b0e6b487a580 (diff) | |
| download | dove-96c136f046d78c51210927e61483a36a220fedcb.tar.xz dove-96c136f046d78c51210927e61483a36a220fedcb.zip | |
Refactor dashboard and mailboxes pages to integrate services for data retrieval
- Updated `Dashboard` function to use `services.Overview()` for rendering overview data.
- Enhanced `Mailboxes` function to include pagination, sorting, and search functionality using `services.ListMailboxes()`.
- Modified `Users` function to implement pagination, sorting, and search with `services.ListUsers()`.
Revamped templates for mailboxes and users
- Updated `mailboxes.htmx.django` to display mailbox items dynamically with total count.
- Enhanced `users.htmx.django` to show user details and total count, with improved layout for user information.
Introduced new response types and constants
- Added `PaginatedResponse` type in `types/response.go` for consistent pagination responses.
- Introduced constants for pagination in `utils/meta/constants.go`.
Implemented email processing and storage services
- Created `services/email.go` for processing incoming emails and storing them in the database.
- Added email parsing utilities in `utils/email` for handling email content and attachments.
Established repository functions for mailboxes, users, and emails
- Created repository functions in `repositories` for managing mailboxes, users, and emails, including listing and searching capabilities.
Refactored SMTP server functions
- Updated SMTP server handling in `utils/smtp` to streamline session management and message processing.
- Removed obsolete storage functions and integrated email processing directly into the SMTP session.
Added new message constants for better logging and error handling
- Introduced message constants in `messages/email.go` and `messages/mailbox.go` for improved clarity in logs.
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/dashboard.go | 3 | ||||
| -rw-r--r-- | pages/mailboxes.go | 8 | ||||
| -rw-r--r-- | pages/users.go | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/pages/dashboard.go b/pages/dashboard.go index 0640192..3fb16fb 100644 --- a/pages/dashboard.go +++ b/pages/dashboard.go @@ -1,6 +1,7 @@ package pages import ( + "dove/services" "dove/utils/meta" "dove/utils/shortcuts" @@ -9,5 +10,5 @@ import ( func Dashboard(context *fiber.Ctx) error { meta.SetPageTitle(context, "Overview") - return shortcuts.Render(context, "dashboard/overview", nil) + return shortcuts.Render(context, "dashboard/overview", services.Overview()) } diff --git a/pages/mailboxes.go b/pages/mailboxes.go index c70574e..317d9c9 100644 --- a/pages/mailboxes.go +++ b/pages/mailboxes.go @@ -1,6 +1,7 @@ package pages import ( + "dove/services" "dove/utils/meta" "dove/utils/shortcuts" @@ -9,5 +10,10 @@ import ( func Mailboxes(context *fiber.Ctx) error { meta.SetPageTitle(context, "Mailboxes") - return shortcuts.Render(context, "dashboard/mailboxes", nil) + + pagination := meta.Paginate(context) + sorting := meta.Sort(context, []string{"address", "created_at"}, "created_at") + search := context.Query("search") + + return shortcuts.Render(context, "dashboard/mailboxes", services.ListMailboxes(pagination, sorting, search)) } diff --git a/pages/users.go b/pages/users.go index ed25cd0..723b544 100644 --- a/pages/users.go +++ b/pages/users.go @@ -1,6 +1,7 @@ package pages import ( + "dove/services" "dove/utils/meta" "dove/utils/shortcuts" @@ -9,5 +10,10 @@ import ( func Users(context *fiber.Ctx) error { meta.SetPageTitle(context, "Users") - return shortcuts.Render(context, "dashboard/users", nil) + + pagination := meta.Paginate(context) + sorting := meta.Sort(context, []string{"username", "display_name", "created_at"}, "created_at") + search := context.Query("search") + + return shortcuts.Render(context, "dashboard/users", services.ListUsers(pagination, sorting, search)) } |
