chore: initial public commit

This commit is contained in:
Gabe Farrell 2025-06-11 19:45:39 -04:00
commit fc9054b78c
250 changed files with 32809 additions and 0 deletions

View file

@ -0,0 +1,23 @@
package handlers
import (
"net/http"
"github.com/gabehf/koito/internal/db"
"github.com/gabehf/koito/internal/logger"
"github.com/gabehf/koito/internal/utils"
)
func GetTopArtistsHandler(store db.DB) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
l := logger.FromContext(r.Context())
opts := OptsFromRequest(r)
artists, err := store.GetTopArtistsPaginated(r.Context(), opts)
if err != nil {
l.Err(err).Msg("Failed to get top artists")
utils.WriteError(w, "failed to get artists", 400)
return
}
utils.WriteJSON(w, http.StatusOK, artists)
}
}