Commit Graph

16 Commits

Author SHA1 Message Date
Sansan 06cbad708d 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-08 20:33:29 +02:00
Sansan 89e884fae9 feat: Implement Session Token System with /api/v1 base path
- Add migration 000004 for sessions table and performance indexes
- Create session.sql queries for CRUD operations
- Generate session repository code with sqlc
- Create token auth middleware for Echo framework
- Create token handler with create/delete/cleanup endpoints
- Add /api/v1 router with token authentication infrastructure
- Update dbHelper.go to use Up() instead of Migrate(2)
- Update server.go to initialize token handler
- Existing endpoints remain functional (to be deprecated)

New endpoints:
- POST /api/v1/token - Create new session token
- DELETE /api/v1/token - Invalidate token
- POST /api/v1/token/cleanup - Remove expired sessions

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-08 20:33:29 +02:00
Sansan 8f8b555ea5 Refactor handlers and update changelog for 5.0.0-Beta
Build / build (push) Successful in 48s
- Split IndexHandler into HealthHandler, VersionHandler, and CharacterHandler
- Rename index.go to version.go in backend
- Change VersionData.Changelog from string to []string
- Add changelog entries for issues #16-#23
- Remove TestDB function and related code
- Fix import ordering in several files

Closes #21, #22
References #16, #17, #18, #19, #20, #23

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-08 20:08:06 +02:00
Sansan 89c31c2856 Replace all log.Println and fmt.Printf with Zap structured logging 2026-05-21 23:24:55 +02:00
Sansan 37909139de Add Zap logging framework with structured logging for Echo and Grafana 2026-05-20 22:29:45 +02:00
Sansan b80ad90eab Add echo-swagger/v2 for Echo v5 compatibility 2026-05-20 22:00:52 +02:00
Sansan 2cff8d16d7 Upgrade Echo framework from v4 to v5 2026-05-20 21:56:06 +02:00
Sansan fabd6a6931 Fix OpenAPI endpoint to serve swagger.json directly 2026-05-18 21:46:51 +02:00
Sansan 1d77ae491c Add OpenAPI endpoint at /openapi with Swagger documentation 2026-05-18 21:43:06 +02:00
Sansan cff777f278 Small fixes to getting character images
Build / build (push) Successful in 44s
Publish / publish (push) Successful in 51s
2025-11-07 20:24:46 +01:00
Sansan 61cab73ffc Small fix to update song played
Build / build (push) Successful in 50s
2025-10-26 20:40:48 +01: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 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
Sansan 034ba35fbb Replaced the gin framwwork with echo 2025-01-13 11:57:48 +01:00