updated to use bun and updated hws modules.

This commit is contained in:
2026-01-11 23:39:10 +11:00
parent 6e03c98ae8
commit 1eedbc5220
33 changed files with 984 additions and 375 deletions

View File

@@ -2,26 +2,27 @@ package handler
import (
"context"
"database/sql"
"git.haelnorr.com/h/golib/hws"
"git.haelnorr.com/h/golib/hwsauth"
"net/http"
"projectreshoot/internal/models"
"time"
"git.haelnorr.com/h/golib/hws"
"git.haelnorr.com/h/golib/hwsauth"
"github.com/uptrace/bun"
)
// Handle a logout request
func Logout(
server *hws.Server,
auth *hwsauth.Authenticator[*models.User],
conn *sql.DB,
auth *hwsauth.Authenticator[*models.UserBun, bun.Tx],
db *bun.DB,
) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), 15*time.Second)
defer cancel()
tx, err := conn.BeginTx(ctx, nil)
tx, err := db.BeginTx(ctx, nil)
if err != nil {
err := server.ThrowError(w, r, hws.HWSError{
StatusCode: http.StatusInternalServerError,