Refactoring for Gin, NoSurf and SCS continues.

This commit is contained in:
2025-10-24 13:08:53 +01:00
parent 7276903733
commit fb07c4a5eb
61 changed files with 546 additions and 524 deletions

View File

@@ -10,7 +10,7 @@ import (
templateHelpers "synlotto-website/internal/helpers/template"
"synlotto-website/internal/models"
"synlotto-website/internal/storage"
usersStorage "synlotto-website/internal/storage/users"
)
var (
@@ -26,7 +26,7 @@ func AdminDashboardHandler(db *sql.DB) http.HandlerFunc {
return
}
user := storage.GetUserByID(db, userID)
user := usersStorage.GetUserByID(db, userID)
if user == nil {
http.Error(w, "User not found", http.StatusUnauthorized)
return
@@ -36,7 +36,7 @@ func AdminDashboardHandler(db *sql.DB) http.HandlerFunc {
context := templateHelpers.TemplateContext(w, r, data)
context["User"] = user
context["IsAdmin"] = user.IsAdmin
// Missing messages, notifications, potentially syndicate notifictions if that becomes a new top bar icon.
// ToDo: Missing messages, notifications, potentially syndicate notifictions if that becomes a new top bar icon.
db.QueryRow(`SELECT COUNT(*), SUM(CASE WHEN is_winner THEN 1 ELSE 0 END), SUM(prize_amount) FROM my_tickets`).Scan(&total, &winners, &prizeSum)
context["Stats"] = map[string]interface{}{
"TotalTickets": total,