From b0acfed8293b6f1281bab1d6dc4f08c584a07078 Mon Sep 17 00:00:00 2001 From: dlwl98 Date: Thu, 2 Nov 2023 14:20:02 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=AA=85=20patchGameParticipate=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/games/patchGameParticipate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/games/patchGameParticipate.ts b/src/api/games/patchGameParticipate.ts index b3591b81..98be83da 100644 --- a/src/api/games/patchGameParticipate.ts +++ b/src/api/games/patchGameParticipate.ts @@ -3,7 +3,7 @@ import { axiosInstance } from '@api/axiosInstance'; import { PatchGameParticipateApplyRequest } from '@type/api/games'; import { Game, Member } from '@type/models'; -export const patchMannerScoreReview = async ({ +export const patchGameParticipate = async ({ payload, gameId, memberId, From 457d7895bab2bd951059c6cbd687e5a73ab5b691 Mon Sep 17 00:00:00 2001 From: dlwl98 Date: Thu, 2 Nov 2023 14:24:31 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=EA=B2=8C=EC=9E=84=20=EC=B0=B8?= =?UTF-8?q?=EC=97=AC=ED=95=98=EA=B8=B0=20mutation=20=ED=9B=85=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=20-=20useGameParticipateCreateMutation=20=ED=9B=85=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/mutations/useGameParticipateCreateMutation.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/hooks/mutations/useGameParticipateCreateMutation.ts diff --git a/src/hooks/mutations/useGameParticipateCreateMutation.ts b/src/hooks/mutations/useGameParticipateCreateMutation.ts new file mode 100644 index 00000000..0dfa78f1 --- /dev/null +++ b/src/hooks/mutations/useGameParticipateCreateMutation.ts @@ -0,0 +1,9 @@ +import { useMutation } from '@tanstack/react-query'; + +import { postGameParticipate } from '@api/games/postGameParticipate'; + +export const useGameParticipateCreateMutation = () => { + return useMutation({ + mutationFn: postGameParticipate, + }); +}; From aed6afb7e390fad5929436546abdf45e0596c16a Mon Sep 17 00:00:00 2001 From: dlwl98 Date: Thu, 2 Nov 2023 14:25:40 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20mockPostGameParticipate=20msw=20han?= =?UTF-8?q?dler=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mocks/handlers/game.ts | 40 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/mocks/handlers/game.ts b/src/mocks/handlers/game.ts index d28230df..e1da12a9 100644 --- a/src/mocks/handlers/game.ts +++ b/src/mocks/handlers/game.ts @@ -1,6 +1,10 @@ import { HttpResponse, http } from 'msw'; -import { PostGameRequest, PostGameResponse } from '@type/api/games'; +import { + PostGameParticipateRequest, + PostGameRequest, + PostGameResponse, +} from '@type/api/games'; import { Game, Member } from '@type/models'; import { games } from '@mocks/data/game'; @@ -59,4 +63,36 @@ const mockGetGames = http.get('/api/games', ({ request }) => { return HttpResponse.json(games.slice(startIndex, startIndex + size)); }); -export const gameHandlers = [mockPostGame, mockGetGames]; +const mockPostGameParticipate = http.post< + { gameId: string }, + { data: PostGameParticipateRequest } +>('/api/games/:gameId/members', async ({ params, request }) => { + const gameId = Number(params.gameId); + const { + data: { memberId }, + } = await request.json(); + + const game = games.find((game) => game.id === gameId); + if (!game) { + return; + } + + game.members.push({ + id: memberId, + email: 'james123@pickple.kr', + nickname: 'james123', + introduction: '안녕하십니까. 제임스입니다. 아이고~ 사장님~~', + profileImageUrl: 'https://s3.amazonaws.com/pickple/james123.jpg', + mannerScore: 21, + mannerScoreCount: 30, + addressDepth1: '서울시', + addressDepth2: '강남구', + positions: ['C', 'PF'], + }); +}); + +export const gameHandlers = [ + mockPostGame, + mockGetGames, + mockPostGameParticipate, +];