feat: Rename game to soundtrack throughout codebase

- Database migration: rename game table to soundtrack
- Rename game_name to soundtrack_name, game_id to soundtrack_id
- Update all SQL queries in soundtrack.sql, song.sql, song_list.sql, statistics.sql
- Regenerate sqlc code (soundtrack.sql.go, song.sql.go, etc.)
- Update backend: music.go, sync.go, statistics.go
- Update server: musicHandler.go, syncHandler.go, routes.go
- Update frontend: hello.go
- Keep URL paths as /games for backward compatibility

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-06-01 20:23:05 +02:00
parent c63202242b
commit 90d621c195
20 changed files with 760 additions and 694 deletions
+10 -10
View File
@@ -229,8 +229,8 @@ func (m *MusicHandler) GetPreviousSong(ctx *echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetAllGames godoc
// @Summary Get all games
// GetAllSoundtracks godoc
// @Summary Get all soundtracks
// @Description Returns a list of all games in order
// @Tags music
// @Accept json
@@ -238,17 +238,17 @@ func (m *MusicHandler) GetPreviousSong(ctx *echo.Context) error {
// @Success 200 {array} map[string]interface{}
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/all/order [get]
func (m *MusicHandler) GetAllGames(ctx *echo.Context) error {
func (m *MusicHandler) GetAllSoundtracks(ctx *echo.Context) error {
if backend.Syncing {
logging.GetLogger().Info("Syncing is in progress")
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
gameList := backend.GetAllGames()
return ctx.JSON(http.StatusOK, gameList)
soundtrackList := backend.GetAllSoundtracks()
return ctx.JSON(http.StatusOK, soundtrackList)
}
// GetAllGamesRandom godoc
// @Summary Get all games random
// GetAllSoundtracksRandom godoc
// @Summary Get all soundtracks random
// @Description Returns a list of all games in random order
// @Tags music
// @Accept json
@@ -256,13 +256,13 @@ func (m *MusicHandler) GetAllGames(ctx *echo.Context) error {
// @Success 200 {array} map[string]interface{}
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/all/random [get]
func (m *MusicHandler) GetAllGamesRandom(ctx *echo.Context) error {
func (m *MusicHandler) GetAllSoundtracksRandom(ctx *echo.Context) error {
if backend.Syncing {
logging.GetLogger().Info("Syncing is in progress")
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
gameList := backend.GetAllGamesRandom()
return ctx.JSON(http.StatusOK, gameList)
soundtrackList := backend.GetAllSoundtracksRandom()
return ctx.JSON(http.StatusOK, soundtrackList)
}
// PutPlayed godoc
+9 -9
View File
@@ -78,13 +78,13 @@ func (s *Server) RegisterRoutes() http.Handler {
sync := NewSyncHandler()
syncGroup := e.Group("/sync")
syncGroup.GET("", deprecatedMiddleware(sync.SyncGamesNewOnlyChanges))
syncGroup.GET("", deprecatedMiddleware(sync.SyncSoundtracksNewOnlyChanges))
syncGroup.GET("/progress", deprecatedMiddleware(sync.SyncProgress))
syncGroup.GET("/new", deprecatedMiddleware(sync.SyncGamesNewOnlyChanges))
syncGroup.GET("/full", deprecatedMiddleware(sync.SyncGamesNewFull))
syncGroup.GET("/new/full", deprecatedMiddleware(sync.SyncGamesNewFull))
syncGroup.GET("/quick", deprecatedMiddleware(sync.SyncGamesNewOnlyChanges))
syncGroup.GET("/reset", deprecatedMiddleware(sync.ResetGames))
syncGroup.GET("/new", deprecatedMiddleware(sync.SyncSoundtracksNewOnlyChanges))
syncGroup.GET("/full", deprecatedMiddleware(sync.SyncSoundtracksNewFull))
syncGroup.GET("/new/full", deprecatedMiddleware(sync.SyncSoundtracksNewFull))
syncGroup.GET("/quick", deprecatedMiddleware(sync.SyncSoundtracksNewOnlyChanges))
syncGroup.GET("/reset", deprecatedMiddleware(sync.ResetDB))
music := NewMusicHandler()
musicGroup := e.Group("/music")
@@ -98,9 +98,9 @@ func (s *Server) RegisterRoutes() http.Handler {
musicGroup.GET("/list", deprecatedMiddleware(music.GetPlayedSongs))
musicGroup.GET("/next", deprecatedMiddleware(music.GetNextSong))
musicGroup.GET("/previous", deprecatedMiddleware(music.GetPreviousSong))
musicGroup.GET("/all", deprecatedMiddleware(music.GetAllGamesRandom))
musicGroup.GET("/all/order", deprecatedMiddleware(music.GetAllGames))
musicGroup.GET("/all/random", deprecatedMiddleware(music.GetAllGamesRandom))
musicGroup.GET("/all", deprecatedMiddleware(music.GetAllSoundtracksRandom))
musicGroup.GET("/all/order", deprecatedMiddleware(music.GetAllSoundtracks))
musicGroup.GET("/all/random", deprecatedMiddleware(music.GetAllSoundtracksRandom))
musicGroup.PUT("/played", deprecatedMiddleware(music.PutPlayed))
musicGroup.GET("/addQue", deprecatedMiddleware(music.AddLatestToQue))
musicGroup.GET("/addPlayed", deprecatedMiddleware(music.AddLatestPlayed))
+17 -17
View File
@@ -34,59 +34,59 @@ func (s *SyncHandler) SyncProgress(ctx *echo.Context) error {
return ctx.JSON(http.StatusOK, response)
}
// SyncGamesNewOnlyChanges godoc
// @Summary Sync games with only changes
// SyncSoundtracksNewOnlyChanges godoc
// @Summary Sync soundtracks with only changes
// @Description Starts syncing games with only new changes
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {string} string "Start syncing games"
// @Success 200 {string} string "Start syncing soundtracks"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /sync [get]
func (s *SyncHandler) SyncGamesNewOnlyChanges(ctx *echo.Context) error {
func (s *SyncHandler) SyncSoundtracksNewOnlyChanges(ctx *echo.Context) error {
if backend.Syncing {
logging.GetLogger().Warn("Syncing is already in progress")
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
logging.GetLogger().Info("Starting sync with only changes")
go backend.SyncGamesNewOnlyChanges()
return ctx.JSON(http.StatusOK, "Start syncing games")
go backend.SyncSoundtracksNewOnlyChanges()
return ctx.JSON(http.StatusOK, "Start syncing soundtracks")
}
// SyncGamesNewFull godoc
// SyncSoundtracksNewFull godoc
// @Summary Sync all games fully
// @Description Starts a full sync of all games
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {string} string "Start syncing games full"
// @Success 200 {string} string "Start syncing soundtracks full"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /sync/full [get]
func (s *SyncHandler) SyncGamesNewFull(ctx *echo.Context) error {
func (s *SyncHandler) SyncSoundtracksNewFull(ctx *echo.Context) error {
if backend.Syncing {
logging.GetLogger().Warn("Syncing is already in progress")
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
logging.GetLogger().Info("Starting full sync")
go backend.SyncGamesNewFull()
return ctx.JSON(http.StatusOK, "Start syncing games full")
go backend.SyncSoundtracksNewFull()
return ctx.JSON(http.StatusOK, "Start syncing soundtracks full")
}
// ResetGames godoc
// @Summary Reset games database
// ResetDB godoc
// @Summary Reset soundtracks database
// @Description Resets the games database by deleting all games and songs
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {string} string "Games and songs are deleted from the database"
// @Success 200 {string} string "Soundtracks and songs are deleted from the database"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /sync/reset [get]
func (s *SyncHandler) ResetGames(ctx *echo.Context) error {
func (s *SyncHandler) ResetDB(ctx *echo.Context) error {
if backend.Syncing {
logging.GetLogger().Warn("Cannot reset - syncing is in progress")
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
}
logging.GetLogger().Info("Resetting games database")
logging.GetLogger().Info("Resetting soundtracks database")
backend.ResetDB()
return ctx.JSON(http.StatusOK, "Games and songs are deleted from the database")
return ctx.JSON(http.StatusOK, "Soundtracks and songs are deleted from the database")
}