more refactors

This commit is contained in:
2026-02-08 19:57:12 +11:00
parent e94a212a08
commit d038f7a42d
17 changed files with 334 additions and 308 deletions

View File

@@ -13,7 +13,7 @@ import (
func AdminDashboard(s *hws.Server, conn *bun.DB) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var users *db.Users
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.GetUsers(ctx, tx, nil)

View File

@@ -14,7 +14,7 @@ import (
// AdminUsersList shows all users
func AdminUsersList(s *hws.Server, conn *bun.DB) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var users *db.Users
var users *db.List[db.User]
pageOpts := pageOptsFromForm(s, w, r)
if pageOpts == nil {
return

View File

@@ -20,7 +20,7 @@ func SeasonsPage(
if pageOpts == nil {
return
}
var seasons *db.SeasonList
var seasons *db.List[db.Season]
if ok := db.WithReadTx(s, w, r, conn, func(ctx context.Context, tx bun.Tx) (bool, error) {
var err error
seasons, err = db.ListSeasons(ctx, tx, pageOpts)
@@ -44,7 +44,7 @@ func SeasonsList(
if pageOpts == nil {
return
}
var seasons *db.SeasonList
var seasons *db.List[db.Season]
if ok := db.WithReadTx(s, w, r, conn, func(ctx context.Context, tx bun.Tx) (bool, error) {
var err error
seasons, err = db.ListSeasons(ctx, tx, pageOpts)