Files
admin-panel/internal/handlers/subscribers.go
coderabbitai[bot] 2adb7e3605 📝 Add docstrings to feat/go-rewrite
Docstrings generation was requested by @blakeridgway.

* https://github.com/RideAware/admin-panel/pull/1#issuecomment-3528008426

The following files were modified:

* `cmd/admin-panel/main.go`
* `internal/config/config.go`
* `internal/database/database.go`
* `internal/email/email.go`
* `internal/handlers/auth.go`
* `internal/handlers/newsletter.go`
* `internal/handlers/subscribers.go`
* `internal/middleware/auth.go`
2025-11-13 14:11:06 +00:00

22 lines
594 B
Go

package handlers
import (
"net/http"
"github.com/rideaware/admin-panel/internal/database"
"github.com/gin-gonic/gin"
)
// IndexGet handles requests for the admin index page by retrieving all subscriber emails
// and rendering the "admin_index.html" template with those emails.
// If retrieving emails fails, it aborts the request with HTTP 500 and the error.
func IndexGet(c *gin.Context) {
emails, err := database.GetAllEmails()
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.HTML(http.StatusOK, "admin_index.html",
gin.H{"emails": emails})
}