aboutsummaryrefslogtreecommitdiff
path: root/pages/mail/users.go
blob: 8700c80327fd966c79eb2e9bb4ba36ec9235751c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package mail

import (
	mailService "dove/services/mail"
	"dove/utils/meta"
	"dove/utils/shortcuts"

	"github.com/gofiber/fiber/v2"
)

func NewUser(context *fiber.Ctx) error {
	meta.SetPageTitle(context, "New User")
	return shortcuts.Render(context, "mail/newuser", nil)
}

func Users(context *fiber.Ctx) error {
	meta.SetPageTitle(context, "Users")

	pagination := meta.Paginate(context)
	sorting := meta.Sort(context, []string{"username", "display_name", "created_at"}, "created_at")
	search := context.Query("search")

	return shortcuts.Render(context, "mail/users", mailService.ListUsers(pagination, sorting, search))
}