admin page updates

This commit is contained in:
2026-02-14 14:54:06 +11:00
parent 55f79176cc
commit 0fc3bb0c94
22 changed files with 2136 additions and 318 deletions

View File

@@ -14,10 +14,20 @@ import (
// AdminUsersPage renders the full admin dashboard page with users section
func AdminUsersPage(s *hws.Server, conn *bun.DB) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var pageOpts *db.PageOpts
if r.Method == "GET" {
pageOpts = pageOptsFromQuery(s, w, r)
} else {
pageOpts = pageOptsFromForm(s, w, r)
}
if pageOpts == nil {
return
}
var users *db.List[db.User]
if ok := db.WithReadTx(s, w, r, conn, func(ctx context.Context, tx bun.Tx) (bool, error) {
var err error
users, err = db.GetUsersWithRoles(ctx, tx, nil)
users, err = db.GetUsersWithRoles(ctx, tx, pageOpts)
if err != nil {
return false, errors.Wrap(err, "db.GetUsersWithRoles")
}