File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -158,11 +158,41 @@ export class BetRoomController {
158158 }
159159
160160 @UseGuards ( JwtGuestAuthGuard )
161- @Get ( "/:betRoomId" )
161+ @Get ( "/:betRoomId/summary " )
162162 async getBetRoom (
163163 @Param ( "betRoomId" ) betRoomId : string ,
164164 @Req ( ) req : Request ,
165165 @Res ( ) res : Response ,
166+ ) {
167+ try {
168+ const userId = req [ "user" ] . id ;
169+ const betRoomData = await this . betRoomService . findBetRoomSummaryById (
170+ userId ,
171+ betRoomId ,
172+ ) ;
173+ return res . status ( HttpStatus . OK ) . json ( {
174+ status : HttpStatus . OK ,
175+ data : {
176+ channel : betRoomData ,
177+ message : "OK" ,
178+ } ,
179+ } ) ;
180+ } catch ( error ) {
181+ return res . status ( error . status || HttpStatus . INTERNAL_SERVER_ERROR ) . json ( {
182+ status : error . status || HttpStatus . INTERNAL_SERVER_ERROR ,
183+ data : {
184+ message : error . message || "Internal Server Error" ,
185+ } ,
186+ } ) ;
187+ }
188+ }
189+
190+ @UseGuards ( JwtGuestAuthGuard )
191+ @Get ( "/:betRoomId" )
192+ async getBetRoomDetails (
193+ @Param ( "betRoomId" ) betRoomId : string ,
194+ @Req ( ) req : Request ,
195+ @Res ( ) res : Response ,
166196 ) {
167197 try {
168198 const userId = req [ "user" ] . id ;
Original file line number Diff line number Diff line change @@ -192,6 +192,31 @@ export class BetRoomService {
192192 return updateResult ;
193193 }
194194
195+ async findBetRoomSummaryById ( userId : number | string , betRoomId : string ) {
196+ const betRoom = await this . betRoomRepository . findOneById ( betRoomId ) ;
197+ if ( ! betRoom ) {
198+ throw new NotFoundException (
199+ `해당하는 베팅방이 존재하지 않습니다. Id: ${ betRoomId } ` ,
200+ ) ;
201+ }
202+ return {
203+ title : betRoom . title ,
204+ options : {
205+ option1 : {
206+ name : betRoom . option1 ,
207+ } ,
208+ option2 : {
209+ name : betRoom . option2 ,
210+ } ,
211+ } ,
212+ status : betRoom . status ,
213+ settings : {
214+ defaultBetAmount : betRoom . defaultBetAmount ,
215+ duration : betRoom . timer ,
216+ } ,
217+ } ;
218+ }
219+
195220 async findBetRoomById ( userId : number | string , betRoomId : string ) {
196221 const betRoom = await this . betRoomRepository . findOneById ( betRoomId ) ;
197222 if ( ! betRoom ) {
You can’t perform that action at this time.
0 commit comments