@@ -4,6 +4,7 @@ import { CommonErrorResponse } from '@type/api/error';
44import {
55 GetGameDetailResponse ,
66 GetGameMembersResponse ,
7+ PostGameParticipateRequest ,
78 PostGameRequest ,
89 PostGameResponse ,
910} from '@type/api/games' ;
@@ -65,6 +66,34 @@ const mockGetGames = http.get('/api/games', ({ request }) => {
6566 return HttpResponse . json ( games . slice ( startIndex , startIndex + size ) ) ;
6667} ) ;
6768
69+ const mockPostGameParticipate = http . post <
70+ { gameId : string } ,
71+ { data : PostGameParticipateRequest }
72+ > ( '/api/games/:gameId/members' , async ( { params, request } ) => {
73+ const gameId = Number ( params . gameId ) ;
74+ const {
75+ data : { memberId } ,
76+ } = await request . json ( ) ;
77+
78+ const game = games . find ( ( game ) => game . id === gameId ) ;
79+ if ( ! game ) {
80+ return ;
81+ }
82+
83+ game . members . push ( {
84+ id : memberId ,
85+ email : 'james123@pickple.kr' ,
86+ nickname : 'james123' ,
87+ introduction : '안녕하십니까. 제임스입니다. 아이고~ 사장님~~' ,
88+ profileImageUrl : 'https://s3.amazonaws.com/pickple/james123.jpg' ,
89+ mannerScore : 21 ,
90+ mannerScoreCount : 30 ,
91+ addressDepth1 : '서울시' ,
92+ addressDepth2 : '강남구' ,
93+ positions : [ 'C' , 'PF' ] ,
94+ } ) ;
95+ } ) ;
96+
6897const mockGetGameMembers = http . get <
6998 { gameId : string } ,
7099 DefaultBodyType ,
@@ -106,4 +135,10 @@ const mockGetGameDetail = http.get<
106135 return HttpResponse . json ( game ) ;
107136} ) ;
108137
109- export const gameHandlers = [ mockPostGame , mockGetGames , mockGetGameDetail , mockGetGameMembers ] ;
138+ export const gameHandlers = [
139+ mockPostGame ,
140+ mockGetGames ,
141+ mockGetGameDetail ,
142+ mockGetGameMembers ,
143+ mockPostGameParticipate ,
144+ ] ;
0 commit comments