Commit Graph

126 Commits

Author SHA1 Message Date
Sansan 3418f492f5 feat: Add deprecation middleware for legacy endpoints
- Create middleware/deprecation.go with DeprecationMiddleware
- Adds Warning and Deprecation headers to old endpoints
- Apply middleware to all non-/api/v1 routes:
  /version, /dbtest, /health, /character*, /download*, /sync/*,
  /music/*
- Message: 'Deprecated: This endpoint is deprecated. Use /api/v1/ endpoints instead.'

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-01 19:41:17 +02:00
Sansan f4d1c3cf28 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>
2026-06-01 19:40:22 +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 3e37303979 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-01 18:07:28 +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 d152ec1f11 fix: use podman-compose (installed via Homebrew) instead of podman compose
Build / build (push) Successful in 45s
2026-05-23 21:57:15 +02:00
Sansan 7a3934babf fix: use 'podman compose' instead of 'podman-compose'
Build / build (push) Successful in 41s
2026-05-23 20:18:25 +02:00
Sansan 08f539abd9 test: add justfile commands for running integration tests with podman
Build / build (push) Successful in 43s
2026-05-23 20:02:25 +02:00
Sansan 87a1a2d89a test: reduce testMusic size for faster CI runs
Build / build (push) Successful in 47s
2026-05-23 19:41:10 +02:00
Sansan 1ada52f5f8 test: add test data directories (testMusic and testCharacters) 2026-05-23 01:06:43 +02:00
Sansan 92b82da3af test: add simple unit tests for backend and logging packages
Build / build (push) Successful in 31s
2026-05-22 22:49:25 +02:00
Sansan b71072f6c8 fix: remove tailwind from dockerfile and add podman-build command
Build / build (push) Successful in 33s
2026-05-22 22:31:10 +02:00
Sansan d481be04a7 Fix YAML formatting in Gitea workflows
Build / build (push) Failing after 2m7s
2026-05-21 23:45:23 +02:00
Sansan 870f1787cb Fix for workflow 2026-05-21 23:35:26 +02:00
Sansan 89c31c2856 Replace all log.Println and fmt.Printf with Zap structured logging 2026-05-21 23:24:55 +02:00
Sansan f0653489d6 Added some files 2026-05-21 22:25:31 +02:00
Sansan d0fbba86f1 Remove frontend-build from build command 2026-05-21 09:56:23 +02:00
Sansan bd0e7f4a8d Add frontend-build command to justfile 2026-05-21 09:54:12 +02:00
Sansan b5926e3b31 Fix frontend build by updating dependencies and ESLint configuration 2026-05-21 09:51:14 +02:00
Sansan 37909139de Add Zap logging framework with structured logging for Echo and Grafana 2026-05-20 22:29:45 +02:00
Sansan 82252ce1ff Use latest for templ CLI in justfile 2026-05-20 22:08:37 +02:00
Sansan 1dab9d6e7c Update all dependencies including templ CLI to latest versions 2026-05-20 22:05:39 +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 12f18ba12c Replace Tailwind CSS with pure CSS for frontend 2026-05-20 21:30:20 +02:00
Sansan 6e2c381d90 Update generate_godot_openapi.py to pass base_url as parameter to _init 2026-05-20 21:23:09 +02:00
Sansan efca22834b Update generate_godot_openapi.py to take file input and generate one file per API tag 2026-05-20 21:19:20 +02:00
Sansan e57609725e Add Swag annotations to all handler endpoints for OpenAPI documentation 2026-05-18 21:50:53 +02:00
Sansan fabd6a6931 Fix OpenAPI endpoint to serve swagger.json directly 2026-05-18 21:46:51 +02:00
Sansan f03e001bdd Add swag-generate to justfile and include in build 2026-05-18 21:44:58 +02:00
Sansan 1d77ae491c Add OpenAPI endpoint at /openapi with Swagger documentation 2026-05-18 21:43:06 +02:00
Sansan c0d1aaa4d1 Update Echo framework to v5.1.1 2026-05-18 21:36:50 +02:00
Sansan 76aaa884fa Change domain from sanplex.tech to sanplex.xyz 2026-05-18 21:27:34 +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 aa0b8275e7 Fix so that ending slash doesn't matter for characters path
Build / build (push) Successful in 40s
2025-11-08 12:04:44 +01:00
Sansan c369b13fae Added characters to Dockerfile
Build / build (push) Successful in 39s
Publish / publish (push) Successful in 47s
2025-11-08 11:54:51 +01:00
Sansan bef915ac6d Fixed gitea script
Build / build (push) Successful in 39s
2025-11-07 21:10:40 +01: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 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 0d1c69d95e Fix 25
Build / build (push) Successful in 42s
Publish / publish (push) Successful in 57s
2025-06-07 22:31:29 +02:00
Sansan b024c0b747 Fixed go.mod 2025-06-05 13:18:21 +02:00
Sansan 75ee924783 Added little logging 2025-06-05 13:15:15 +02:00
Sansan f86c33d5e6 Removed gitea-ci 2025-06-05 13:15:15 +02:00
Sansan ef41d0fa11 Fix 24 2025-06-05 13:15:15 +02:00
Sansan fd666dd3fa Fix 23 2025-06-05 13:15:15 +02:00
Sansan 231867de40 Fix 22 2025-06-05 13:15:15 +02:00
Sansan 9a9d318771 Fix 21 2025-06-05 13:15:15 +02:00