Merged
Conversation
BREAKING_CHANGES: add three table in game.db match, tournament, tournament_player add request for adding and udating database next: add route and controller to interact with database package-lock.json srcs/.env.game.example srcs/game/package.json srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/game/src/routes/game.routes.ts srcs/game/src/types/game.dto.ts
newTournament: create a Tournament and send his id to the frontend FastifyJWT: new interface for prehandler request update(front): fakeCreateTournament -> CreatingTournament Input: addc toggle button to sho/hide the password package-lock.json srcs/.env.game.example srcs/game/package.json srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/game/src/pulgins/auth.plugin.ts srcs/game/src/routes/game.routes.ts srcs/game/src/server.ts srcs/game/src/types/fastify.d.ts srcs/nginx/src/components/atoms/Input.tsx srcs/nginx/src/pages/TournamentCreatePage.tsx
feat(game-database): add new table player to have username add sql request for listing tournaments srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/users/src/app.ts srcs/users/src/config/env.ts srcs/users/src/plugins/ioredis.plugins.ts
add to type in user.schema.ts feat(game-redis): add ioredis plugins, consumer fastify hook onReady StartGameConsumer feat(game-db): add sql request for upsert user and deleted feat(user-redis): add data to stream user.events in controller feat(game): add envalid to config env package-lock.json srcs/docker-compose.yml srcs/game/package.json srcs/game/src/config/env.ts srcs/game/src/core/game.consumer.ts srcs/game/src/core/game.database.ts srcs/game/src/plugins/auth.plugin.ts srcs/game/src/plugins/ioredis.plugin.ts srcs/game/src/server.ts srcs/game/src/types/fastify.d.ts srcs/game/tsconfig.json srcs/shared/core/src/index.ts srcs/shared/core/src/schemas/user.schema.ts srcs/users/src/app.ts srcs/users/src/controllers/profiles.controller.ts srcs/users/src/types/fastify.d.ts srcs/users/tsconfig.json
feat(game-tournament): add Tournament List page add sql request for list tournament fix(game): root route :sessionId intercept all get routes change to ws/:sessionId package-lock.json srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/game/src/routes/game.routes.ts srcs/gateway/src/controllers/game.controller.ts srcs/nginx/src/pages/TournamentsListPage.tsx srcs/shared/core/src/index.ts srcs/shared/core/src/schemas/game.schema.ts
feat(user-events): add event bus insteaed of calling redis.xadd directly in controller fix(gane-data): add player(creator) when creating a tournament package-lock.json srcs/game/src/core/game.consumer.ts srcs/game/src/core/game.database.ts srcs/shared/core/src/index.ts srcs/shared/core/src/schemas/user.schema.ts srcs/users/src/app.ts srcs/users/src/controllers/profiles.controller.ts srcs/users/src/events/redis.subscriber.ts srcs/users/src/events/user.bus.ts
srcs/users/test/profiles.controller.test.ts
srcs/users/vite.config.mjs
srcs/users/src/plugins/ioredis.plugins.ts
srcs/blockchain/src/plugins/fastify-ioredis.ts srcs/game/src/plugins/ioredis.plugin.ts srcs/users/src/plugins/ioredis.plugins.ts
fix function to join a Tournament in backend srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/game/src/routes/game.routes.ts srcs/nginx/src/components/atoms/TournamentList.tsx srcs/nginx/src/locales/en/common.json srcs/nginx/src/locales/fr/common.json srcs/nginx/src/locales/tf/common.json srcs/nginx/src/pages/TournamentsListPage.tsx srcs/users/src/plugins/ioredis.plugins.ts
feat(game-data-test): add python file for testing tournament managing package-lock.json srcs/game/src/controllers/game.controller.ts srcs/tests/test_tournament.py
srcs/tests/test.py srcs/tests/test_tournament.py
replace mock data by fetch daat from backend to load players in a tournament update event bus in user service to send avatarulr to game service to avoid fetching in front end update DTO in transcendence core package-lock.json srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/game/src/routes/game.routes.ts srcs/nginx/src/App.tsx srcs/nginx/src/pages/TournamentPage.tsx srcs/shared/core/src/index.ts srcs/shared/core/src/schemas/game.schema.ts srcs/shared/core/src/schemas/user.schema.ts srcs/users/src/events/redis.subscriber.ts
add avatar url in db game to avoid to o much fecth in client side add event to update avatar url in redis when user change it package-lock.json srcs/game/src/core/game.database.ts srcs/users/src/controllers/profiles.controller.ts srcs/users/src/events/redis.subscriber.ts
update(game-front): Tournament page has only one StartButton feat(front-data): add event user update to have avatarurl in game database update(font-game): load avatar in playercapsule update(locales): update translation files fix(game-data): don't return error when joining a tournament you have alredy joined docs/redis.md package-lock.json srcs/game/src/core/game.database.ts srcs/nginx/src/components/atoms/CircleButtonSimple.tsx srcs/nginx/src/components/atoms/MatchNode.tsx srcs/nginx/src/components/atoms/StartButton.tsx srcs/nginx/src/components/molecules/TournamentBracket.tsx srcs/nginx/src/locales/en/common.json srcs/nginx/src/locales/fr/common.json srcs/nginx/src/locales/tf/common.json srcs/nginx/src/pages/TournamentMenuPage.tsx srcs/nginx/src/pages/TournamentPage.tsx srcs/nginx/src/pages/TournamentsListPage.tsx srcs/users/src/controllers/profiles.controller.ts srcs/users/src/events/redis.subscriber.ts srcs/users/src/services/profiles.service.ts srcs/users/src/utils/mappers.ts
srcs/users/test/profiles.controller.test.ts srcs/users/test/profiles.service.test.ts
srcs/nginx/src/components/atoms/MatchNode.tsx srcs/nginx/src/components/molecules/TournamentBracket.tsx srcs/nginx/src/pages/TournamentCreatePage.tsx srcs/nginx/src/pages/TournamentPage.tsx srcs/nginx/src/pages/TournamentsListPage.tsx
.github/workflows/ci.yml cookies.txt srcs/game/src/controllers/game.controller.ts srcs/tests/test_tournament.py
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements tournament data management for the game service using a "Database per service + Data replication" pattern. The main goal is to establish backend-frontend communication through REST API routes and integrate Redis streams for inter-service communication.
Changes:
- Added SQLite database schema for tournaments, matches, players, and tournament_players
- Implemented Redis streams consumer in game service to sync user data from user service
- Created REST API routes for tournament CRUD operations with authentication
- Integrated frontend React components to consume tournament APIs with polling
- Added authentication plugin to game service using JWT
- Added functional tests for tournament creation and joining
Reviewed changes
Copilot reviewed 49 out of 53 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| srcs/game/src/core/game.database.ts | SQLite database operations for tournaments and players |
| srcs/game/src/core/game.consumer.ts | Redis streams consumer for user event synchronization |
| srcs/game/src/plugins/auth.plugin.ts | JWT authentication plugin for game service |
| srcs/game/src/plugins/ioredis.plugin.ts | Redis client plugin with graceful shutdown |
| srcs/game/src/controllers/game.controller.ts | Tournament REST API endpoints |
| srcs/game/src/routes/game.routes.ts | Route definitions with authentication middleware |
| srcs/users/src/events/redis.subscriber.ts | User event publisher to Redis streams |
| srcs/users/src/plugins/ioredis.plugins.ts | Redis plugin for user service |
| srcs/nginx/src/pages/TournamentsListPage.tsx | Tournament list UI with polling |
| srcs/nginx/src/pages/TournamentPage.tsx | Tournament detail page with real-time updates |
| srcs/tests/test_tournament.py | Functional tests for tournament endpoints |
| cookies.txt | Security risk: Contains JWT token that should not be committed |
| docs/redis.md | Documentation for Redis streams testing commands |
added 2 commits
February 23, 2026 16:17
package-lock.json.orig
cookies.txt
rom98759
requested changes
Feb 23, 2026
Collaborator
rom98759
left a comment
There was a problem hiding this comment.
Tres bien, petit fix a faire et c'est parfait
package-lock.json srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.database.ts srcs/nginx/package.json srcs/nginx/src/pages/TournamentPage.tsx srcs/nginx/src/pages/TournamentsListPage.tsx srcs/shared/core/src/errors/error-catalog.ts srcs/shared/core/src/errors/error-types.ts srcs/shared/core/src/logging/logging.ts
BREAKING CHANGES Apperror db.transaction to avoid race condition package-lock.json srcs/.env.game.example srcs/game/src/controllers/game.controller.ts srcs/game/src/core/game.consumer.ts srcs/game/src/core/game.database.ts srcs/game/src/plugins/auth.plugin.ts srcs/game/src/routes/game.routes.ts srcs/game/src/server.ts srcs/game/src/types/fastify.d.ts srcs/shared/core/src/errors/error-catalog.ts srcs/tests/test_tournament.py
fix(env): no need jwt env anymore srcs/game/src/config/env.ts srcs/game/src/controllers/game.controller.ts
srcs/game/src/controllers/game.controller.ts srcs/nginx/src/router/TournamentGuard.tsx srcs/nginx/src/router/TournamentRoutes.tsx
codastream
reviewed
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Draft sur la gestion des
donneesdu GameImportant
Cette PR concerne :
Schema de la base dans game-service
erDiagram TOURNAMENT { INTEGER id PK INTEGER creator_id TEXT status INTEGER created_at } MATCH { INTEGER id PK INTEGER tournament_id TEXT sessionId INTEGER player1 INTEGER player2 INTEGER score_player1 INTEGER score_player2 INTEGER winner_id TEXT round INTEGER created_at } TOURNAMENT_PLAYER { INTEGER tournament_id PK INTEGER player_id PK INTEGER final_position } PLAYER { INTEGER id PK TEXT username TEXT avatar INTEGER updated_at } TOURNAMENT ||--o{ MATCH : contains TOURNAMENT ||--o{ TOURNAMENT_PLAYER : has_players TOURNAMENT }o--|| PLAYER : is MATCH }o--|| PLAYER : is TOURNAMENT_PLAYER }o--|| PLAYER : isNavigation dans le Tournoi
flowchart TD %% Entry A[Home / TournamentMenuPage.tsx] A -->|Participate| B[TournamentsListPage.tsx] A -->|Create| C[TournamentCreatePage.tsx] C -->|POST /game/create-tournament| D[(Create tournament in DB)] D -->|return tournamentId| E[TournamentPage.tsx] B -->|Join| E %% Tournament structure E --> F{4 players ready?} F -->|Yes| SF1[Semi-Final 1] F -->|Yes| SF2[Semi-Final 2] %% Semi Final 1 SF1 --> G1{Both players Start?} G1 -->|Yes| M1[Play Match 1] M1 -->|Save score in game.db| R1[Determine Winner/Loser 1] %% Semi Final 2 SF2 --> G2{Both players Start?} G2 -->|Yes| M2[Play Match 2] M2 -->|Save score in game.db| R2[Determine Winner/Loser 2] %% Propagation R1 -->|Winner → Final P1| FP1[Final Slot P1] R1 -->|Loser → Small Final P1| SP1[Small Final Slot P1] R2 -->|Winner → Final P2| FP2[Final Slot P2] R2 -->|Loser → Small Final P2| SP2[Small Final Slot P2] %% Final FP1 --> FINAL{Both players Start?} FP2 --> FINAL FINAL -->|Yes| FM[Play Final] FM -->|Save score in game.db| FW[Determine Champion] %% Small Final SP1 --> SMALL{Both players Start?} SP2 --> SMALL SMALL -->|Yes| SM[Play Small Final] SM -->|Save score in game.db| SW[Determine 3rd place] %% Tournament completion FW --> UPDATE[Update Tournament_player positions] SW --> UPDATE UPDATE --> END[Tournament Completed]Services Game
Ajout du plugin custom Authplugin
userAjout du plugin ioredis
user-eventsdans le service user au moment de la création du profile.Onreadyde Fastify.Modifications de certains composants
Routes Front(React) - Back(Fastify) du tournoi
GETapi/game/tournamentsPOSTapi/game/create-tournamentGETapi/game/tournaments/:idPostapi/game/tournaments/:idCaution
Changement route dans Game