Connect GamerZ Hub Database Load to Appwrite & 15-Game Capability Expansion - #37
Conversation
Co-authored-by: omharde42 <193398705+omharde42@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| return { | ||
| gameId: game.gameId, | ||
| joinCapability: 'ROOM_CODE', | ||
| instructions: `1. Open ${game.displayName}.\n2. Select Private/Custom Room mode.\n3. Enter Room ID: ${sessionData.roomCode} ${sessionData.roomPassword ? `and Password: ${sessionData.roomPassword}` : ''}.`, |
| return { | ||
| gameId: game.gameId, | ||
| joinCapability: 'ROOM_CODE', | ||
| instructions: `1. Open ${game.displayName}.\n2. Select Private/Custom Room mode.\n3. Enter Room ID: ${sessionData.roomCode} ${sessionData.roomPassword ? `and Password: ${sessionData.roomPassword}` : ''}.`, |
| joinCapability: 'ROOM_CODE', | ||
| instructions: `1. Open ${game.displayName}.\n2. Select Private/Custom Room mode.\n3. Enter Room ID: ${sessionData.roomCode} ${sessionData.roomPassword ? `and Password: ${sessionData.roomPassword}` : ''}.`, | ||
| roomCode: sessionData.roomCode, | ||
| roomPassword: sessionData.roomPassword || null, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7221237ca0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
| } | ||
|
|
||
| return { |
There was a problem hiding this comment.
Persist game session state before reporting success
createOrFindSession only constructs and returns an object; it never stores the session anywhere. Consequently, every newly exposed session route operates on arbitrary IDs: join requests disappear immediately, hosts cannot retrieve or approve real requests, and any authenticated caller can mark a fabricated request/session accepted or completed. Persist the session and request records and load them with host/participant authorization before returning success.
Useful? React with 👍 / 👎.
| const profiles = await prisma.profile.findMany({ | ||
| take: parsedLimit, | ||
| where: req.user?.userId ? { userId: { not: req.user.userId } } : {}, |
There was a problem hiding this comment.
Apply discovery filters to the PostgreSQL fallback
When Appwrite is unavailable or its cache is cold, this fallback ignores every requested rank, playstyle, language, and availability filter; it only excludes the caller. Thus requests such as ?rank=HEROIC&language=HINDI return the highest-scoring profiles regardless of the supplied criteria, while the Appwrite path applies those filters. Add the same predicates to the Prisma query before caching and returning candidates.
Useful? React with 👍 / 👎.
| const cachedRegistry = await appwriteService.getGameRegistry(); | ||
| if (cachedRegistry && Object.keys(cachedRegistry).length > 0) { | ||
| return sendSuccess(res, Object.values(cachedRegistry), 'Canonical game registry fetched via Appwrite read model'); |
There was a problem hiding this comment.
Populate the registry cache atomically
This treats any nonempty Appwrite registry as complete, but the fallback below starts one unawaited write per game. After the first write succeeds and before the rest do (or if some fail), the next request returns only that partial subset and never falls back to the full canonical registry. The equivalent condition exists on /api/game/registry as well, so both registry APIs can intermittently hide supported games.
Useful? React with 👍 / 👎.
| borderColor: 'border-yellow-500/40', | ||
| }, | ||
| { | ||
| id: 'clashofclans', |
There was a problem hiding this comment.
Keep catalog IDs aligned with connection-state mapping
Existing connected Clash of Clans, Brawl Stars, and Clash Royale accounts are normalized by PopularGamesModal to clash_of_clans, brawl_stars, and clash_royale, but the changed catalog now uses the unseparated IDs. Therefore connectedGameIds.has(game.id) is false for these accounts, so the catalog no longer labels them connected and lets the user select a duplicate connection flow. Update the unchanged normalization/mapping consumers or retain compatible catalog IDs.
Useful? React with 👍 / 👎.
Integrate Appwrite server SDK (node-appwrite) to handle high-read database workloads (game registry, public gamer profiles, game profiles, teammate discovery) with PostgreSQL/Supabase write-through synchronization and automatic fallback. Expand canonical game registry and capability adapter architecture to 15 games.
PR created automatically by Jules for task 12713316917790388748 started by @omharde42