summaryrefslogtreecommitdiff
path: root/controllers/mail.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-12-24 13:50:07 +0530
committerBobby <[email protected]>2025-12-24 13:50:07 +0530
commitb77d75f05fb2059389c05f6c01484e0cd12e796e (patch)
treee3c5521bf9ed3fcffd59960053d651091496a7ea /controllers/mail.go
parent81ab367f440d6f85297b2013d0c1aa57fda7e9cd (diff)
downloadlain-b77d75f05fb2059389c05f6c01484e0cd12e796e.tar.xz
lain-b77d75f05fb2059389c05f6c01484e0cd12e796e.zip
feat: introduce email folder synchronization and management, refactor email services, and update UI styles
Diffstat (limited to 'controllers/mail.go')
-rw-r--r--controllers/mail.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/controllers/mail.go b/controllers/mail.go
index 36166ce..c4112d1 100644
--- a/controllers/mail.go
+++ b/controllers/mail.go
@@ -2,7 +2,7 @@ package controllers
import (
"lain/models"
- "lain/repository"
+ "lain/services"
"lain/session"
"lain/utils/meta"
"lain/utils/shortcuts"
@@ -16,25 +16,22 @@ func Mailbox(context *fiber.Ctx) error {
folderPath = "inbox"
}
- email, err := session.GetSessionEmail(context)
+ userEmail, err := session.GetSessionEmail(context)
if err != nil {
return InternalServerError(context, err)
}
prefs := context.Locals("Preferences").(*models.Preferences)
- folders := repository.GetFolders(email, folderPath)
- displayName := repository.GetFolderDisplayName(email, folderPath)
+ folders := services.GetFolders(userEmail, folderPath)
+ displayName := services.GetFolderDisplayName(userEmail, folderPath)
page := context.QueryInt("page", 1)
if page < 1 {
page = 1
}
- limit := prefs.EmailsPerPage
- offset := (page - 1) * limit
-
- emails, err := repository.GetEmails(email, folderPath, limit, offset)
+ emails, err := services.GetEmails(userEmail, folderPath, prefs, page)
if err != nil {
emails = []fiber.Map{}
}