Skip to content

Commit

Permalink
fix: 방 종료 시 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
moozeh committed Nov 27, 2024
1 parent 1a6178d commit 8e068a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions backend/src/room/dto/finish-room.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { IsNotEmpty } from "class-validator";

export class FinishRoomDto {
@IsNotEmpty()
roomId: string;
}
6 changes: 4 additions & 2 deletions backend/src/room/room.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { RoomLeaveService } from "@/room/services/room-leave.service";
import { RoomCreateService } from "@/room/services/room-create.service";
import { RoomJoinService } from "@/room/services/room-join.service";
import { websocketConfig } from "@/websocket/websocket.config";
import { FinishRoomDto } from "@/room/dto/finish-room.dto";

@WebSocketGateway(websocketConfig)
export class RoomGateway implements OnGatewayDisconnect {
Expand Down Expand Up @@ -62,8 +63,9 @@ export class RoomGateway implements OnGatewayDisconnect {
}

@SubscribeMessage(LISTEN_EVENT.FINISH)
public async handleFinishRoom(client: Socket) {
const roomId = await this.roomService.finishRoom(client.id);
@UsePipes(new ValidationPipe({ transform: true }))
public async handleFinishRoom(@MessageBody() dto: FinishRoomDto) {
const roomId = await this.roomService.finishRoom(dto.roomId);
this.socketService.emitToRoom(roomId, EMIT_EVENT.FINISH);
}

Expand Down

0 comments on commit 8e068a7

Please sign in to comment.