Commit Graph

14 Commits

Author SHA1 Message Date
Sansan 9256b7fe4b feat: Add id column to song table and prep for UUID migration
- Add id serial4 PK to song table (was composite PK)
- Update queries to use soundtrack_id + path
- Add UUID columns to soundtrack and song (nullable)
- Add migration tracking table

TODO: Run sqlc generate, then create backfill migration (000008)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-01 21:58:21 +02:00
Sansan 90d621c195 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>
2026-06-01 20:23:05 +02:00
Sansan 98c1948eff feat: Remove global db.Dbpool with dependency injection (Phase 0)
- Add Database struct in internal/db/database.go with Pool, Ctx, and RunMigrations()
- Update server.go to use Database struct with NewServerInstance()
- Add backend.go with InitBackend(), BackendRepo(), BackendCtx(), BackendPool()
- Update music.go and sync.go to use BackendRepo() and BackendCtx() instead of db.Dbpool/db.Ctx
- Update token_handler.go to accept pool parameter
- Update routes.go to use s.db.Pool for middleware
- Update cmd/main.go to use NewServerInstance() and HTTPServer()
- Update test_helpers.go to initialize backend with test database
- Update test files to use backend.BackendPool() and backend.BackendCtx()

Benefits:
- Easier to mock database for unit tests
- Follows Go best practices (dependency injection)
- Better architecture with explicit dependencies
- RunMigrations() replaces old Migrate_db() function

Note: Global db.Dbpool and db.Ctx still exist in dbHelper.go for backward compatibility
with test_helpers.go, but production code no longer uses them.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-01 18:50:05 +02:00
Sansan a446dad7b6 Make pool and poolSong global variables
Build / build (push) Successful in 48s
2026-05-26 20:54:12 +02:00
Sansan 1ada52f5f8 test: add test data directories (testMusic and testCharacters) 2026-05-23 01:06:43 +02:00
Sansan 89c31c2856 Replace all log.Println and fmt.Printf with Zap structured logging 2026-05-21 23:24:55 +02:00
Sansan 290d79ef5e Changed how time are sent to frontend during sync
Build / build (push) Successful in 40s
2025-11-15 14:55:03 +01:00
Sansan a6294e46f2 Small changes to sync progress
Build / build (push) Successful in 52s
2025-09-19 22:10:27 +02:00
Sansan 5f91643b4d Added time to sync and progress respond
Build / build (push) Successful in 1m58s
2025-08-30 13:36:45 +02:00
Sansan 806e88adeb #1 - Created request to check newest version of the app
Build / build (push) Successful in 2m35s
#2 - Added request to download the newest version of the app
#3 - Added request to check progress during sync
#4 - Now blocking all request while sync is in progress
#5 - Implemented ants for thread pooling
#6 - Changed the sync request to now only start the sync
2025-08-23 11:36:03 +02:00
Sansan 75ee924783 Added little logging 2025-06-05 13:15:15 +02:00
Sansan d653463f58 Moved around more code. Implemented more sqlc. Added support to generate swagger.
Added support for profiling. Removed the pkg module altogether.
Everything except old sync is now using code generated by sqlc.
2025-01-15 16:04:14 +01:00
Sansan db8214cb02 Added support for fetching character images from the server 2025-01-14 10:01:48 +01:00
Sansan 5b640375c3 Reorganized the code, moved more things to the new part 2025-01-13 16:08:54 +01:00