feat: Implement Statistics API with 8 endpoints under /api/v1/statistics/

- Add statistics.sql with 8 SQL queries for play count statistics
- Generate repository code via sqlc
- Add backend/statistics.go with business logic
- Add server/statistics_handler.go with Echo handlers
- Register protected routes under /api/v1/statistics/ with token auth
- Endpoints: games/most-played, games/least-played, games/never-played,
  games/last-played, games/oldest-played, songs/most-played,
  songs/least-played, summary

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-06-01 19:40:22 +02:00
parent 06cbad708d
commit 4c2db11cc5
6 changed files with 1178 additions and 10 deletions
+12 -7
View File
@@ -15,10 +15,11 @@ import (
)
type Server struct {
port int
db *db.Database
tokenHandler *TokenHandler
httpServer *http.Server
port int
db *db.Database
tokenHandler *TokenHandler
statisticsHandler *StatisticsHandler
httpServer *http.Server
}
var (
@@ -67,12 +68,16 @@ func NewServerInstance() *Server {
// Initialize token handler with database pool
tokenHandler := NewTokenHandler(database.Pool)
// Initialize statistics handler
statisticsHandler := NewStatisticsHandler()
// Create the server instance
appServer := &Server{
port: port,
db: database,
tokenHandler: tokenHandler,
port: port,
db: database,
tokenHandler: tokenHandler,
statisticsHandler: statisticsHandler,
}
// Create the HTTP server