Add user theme support and migrate frontend to HTMX templates

- Add theme column to users table with default 'tokyo-night'
- Update all user queries to include theme field
- Add ListUsers and UpdateUserTheme database queries
- Update auth handlers to support HTMX form submissions and JSON API
- Add ListUsers API endpoint
- Replace embedded static files with Go templates
- Update Dockerfile to copy templates directory
- Redesign index.html with inline styles and HTMX forms
- Update Bruno API testing requests for auth endpoints
This commit is contained in:
2026-01-22 18:38:06 -05:00
parent 2399e892a6
commit e32fda6b65
12 changed files with 644 additions and 222 deletions
+10 -4
View File
@@ -1,6 +1,6 @@
-- name: CreateUser :one
INSERT INTO users (email, username, password_hash)
VALUES ($1, $2, $3)
INSERT INTO users (email, username, password_hash, theme)
VALUES ($1, $2, $3, $4)
RETURNING *;
-- name: GetUserByEmail :one
@@ -13,7 +13,10 @@ SELECT * FROM users WHERE username = $1;
SELECT * FROM users WHERE email = $1 OR username = $1;
-- name: GetUser :one
SELECT id, email, username, created_at, updated_at FROM users WHERE id = $1;
SELECT id, email, username, theme, created_at, updated_at FROM users WHERE id = $1;
-- name: ListUsers :many
SELECT id, email, username, theme, created_at, updated_at FROM users ORDER BY created_at DESC;
-- name: GetEbook :one
SELECT * FROM ebooks WHERE id = $1;
@@ -54,4 +57,7 @@ DO UPDATE SET
RETURNING *;
-- name: DeleteReadingProgress :exec
DELETE FROM reading_progress WHERE ebook_id = $1 AND user_id = $2;
DELETE FROM reading_progress WHERE ebook_id = $1 AND user_id = $2;
-- name: UpdateUserTheme :exec
UPDATE users SET theme = $2, updated_at = NOW() WHERE id = $1;