-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: player-data DTO 추가 * feat: 준비 완료, 강퇴 기능 추가 * test: 준비 완료, 강퇴 테스트 * docs: swagger 정리
- Loading branch information
1 parent
8975f48
commit 8e73dc4
Showing
13 changed files
with
472 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { WebSocketGateway, WebSocketServer } from '@nestjs/websockets'; | ||
import { Server } from 'socket.io'; | ||
import { RedisService } from '../../redis/redis.service'; | ||
import { Logger, UseFilters } from '@nestjs/common'; | ||
import { WsExceptionsFilter } from '../../common/filters/ws-exceptions.filter'; | ||
|
||
@WebSocketGateway({ | ||
namespace: '/games', | ||
cors: { | ||
origin: '*', | ||
methods: ['GET', 'POST'], | ||
credentials: true, | ||
}, | ||
}) | ||
@UseFilters(WsExceptionsFilter) | ||
export class GamesGateway { | ||
private readonly logger = new Logger(GamesGateway.name); | ||
|
||
@WebSocketServer() | ||
server: Server; | ||
|
||
constructor(private readonly redisService: RedisService) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { RedisModule } from '../../redis/redis.module'; | ||
import { GamesGateway } from './games.gateway'; | ||
|
||
@Module({ | ||
imports: [RedisModule], | ||
providers: [GamesGateway], | ||
controllers: [], | ||
}) | ||
export class GamesModule {} |
6 changes: 6 additions & 0 deletions
6
be/gameServer/src/modules/games/games.websocket.emit.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Controller } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
|
||
@ApiTags('Games (WebSocket: 서버에서 발행하는 이벤트)') | ||
@Controller('games') | ||
export class RoomsWebSocketEmitController {} |
6 changes: 6 additions & 0 deletions
6
be/gameServer/src/modules/games/games.websocket.on.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Controller } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
|
||
@ApiTags('Games (WebSocket: 서버에서 수신하는 이벤트)') | ||
@Controller('games') | ||
export class RoomsWebSocketOnController {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class PlayerDataDto { | ||
@ApiProperty({ | ||
example: 'playerNickname123', | ||
description: '플레이어의 닉네임', | ||
}) | ||
playerNickname: string; | ||
|
||
@ApiProperty({ | ||
example: true, | ||
description: '플레이어의 준비 상태 (true: 준비 완료, false: 대기 중)', | ||
}) | ||
isReady: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.