admin: add delete user with confirmation dialog

This commit is contained in:
2026-04-22 21:27:37 +02:00
parent ee05ad7511
commit b1bb205d55
4 changed files with 57 additions and 0 deletions

View File

@@ -7,6 +7,9 @@ SELECT * FROM user WHERE username = ? LIMIT 1;
-- name: ListUsers :many
SELECT * FROM user ORDER BY created_at DESC;
-- name: DeleteUser :exec
DELETE FROM user WHERE id = ?;
-- name: CreateUser :one
INSERT INTO user (id, username, password_hash)
VALUES (?, ?, ?)

View File

@@ -111,6 +111,8 @@ func NewRouter(cfg Config) http.Handler {
mux.Handle("/admin/users/", middleware.RequireAdmin(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
switch {
case strings.HasSuffix(path, "/delete"):
adminHandler.HandleDeleteUser(w, r)
case strings.HasSuffix(path, "/watchlist"):
adminHandler.HandleUserWatchlist(w, r)
case strings.HasSuffix(path, "/continue-watching"):