From 455a4a31a9013d5f6098c8fe3ffcabf7e0952be2 Mon Sep 17 00:00:00 2001 From: Yashvardhan Jagnani Date: Sat, 7 Sep 2024 12:14:10 +0530 Subject: [PATCH] nit --- .../microservices/connect-four/connect-four.routes.ts | 4 ++-- .../microservices/played-games/played-games.service.ts | 5 +++-- .../rock-paper-scissors/rock-paper-scissors.routes.ts | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/backend/microservices/connect-four/connect-four.routes.ts b/packages/backend/microservices/connect-four/connect-four.routes.ts index 4a739a8..5860a34 100644 --- a/packages/backend/microservices/connect-four/connect-four.routes.ts +++ b/packages/backend/microservices/connect-four/connect-four.routes.ts @@ -6,7 +6,7 @@ import { } from "../../utils/functions"; import { addPlayer2ToGame, - createGame, + createDBGame, fetchPlayersDetailsForPlayedGame, setWinnerToGame, } from "../played-games/played-games.service"; @@ -50,7 +50,7 @@ export const ConnectFourRoutes = async (socket: Socket, io: Namespace) => { `no room found for room key ${roomKey}`, ); - const { played_game_id } = await createGame( + const { played_game_id } = await createDBGame( player_id, season_id, game_id, diff --git a/packages/backend/microservices/played-games/played-games.service.ts b/packages/backend/microservices/played-games/played-games.service.ts index c38a45c..6fa7319 100644 --- a/packages/backend/microservices/played-games/played-games.service.ts +++ b/packages/backend/microservices/played-games/played-games.service.ts @@ -39,7 +39,7 @@ export const setAttestationAndWithdrawRewards = async ( return playedGameData; }; -export const createGame = async ( +export const createDBGame = async ( player_1_id: MappedPlayedGame["player_1_id"], season_id: MappedPlayedGame["season_id"], game_id: MappedPlayedGame["game_id"], @@ -81,7 +81,8 @@ export const addPlayer2ToGame = async ( is_active: true, }) .eq("played_game_id", played_game_id) - .select(); + .select() + .single(); if (error) { console.error(error); diff --git a/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts b/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts index 6a220c3..1e80fe6 100644 --- a/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts +++ b/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts @@ -6,7 +6,7 @@ import { } from "../../utils/functions"; import { addPlayer2ToGame, - createGame, + createDBGame, fetchPlayersDetailsForPlayedGame, setWinnerToGame, } from "../played-games/played-games.service"; @@ -52,7 +52,7 @@ export const RockPaperScissorsRoutes = async ( `no room found for room key ${roomKey}`, ); - const { played_game_id } = await createGame( + const { played_game_id } = await createDBGame( player_id, season_id, game_id,