Skip to content

[STORY] 게임 방 타입 분리 API (Backend) #178

Description

@DDINGJOO

Parent Epic

개요

기존 채팅방 API를 확장하여 게임 방 타입을 지원합니다.

상세 요구사항

1. Room 스키마 변경

interface Room {
  // 기존 필드
  roomId: string
  name: string
  
  // NEW
  type: 'CHAT' | 'GAME'
  gameType?: 'CATCHMIND'
  status: 'WAITING' | 'PLAYING' | 'FINISHED'
  gameSettings?: {
    maxRounds: number
    roundTimeLimit: number
  }
}

2. API 변경

API 변경 사항
POST /chat/rooms body에 type, gameType 필드 추가
GET /chat/rooms ?type=GAME&gameType=CATCHMIND&status=WAITING 필터 추가
POST /chat/rooms/:id/game/start type: 'GAME' 방에서만 허용
POST /chat/rooms/:id/game/restart NEW - 게임 재시작
DELETE /chat/rooms/:id NEW - 방 삭제 (방장만)

3. WebSocket 메시지

  • 기존 메시지 유지
  • room_status_change 메시지 추가 (WAITING → PLAYING → FINISHED)
  • host_change 메시지 추가 (방장 변경 시)

Tasks

  • Room 스키마에 type, gameType, status 필드 추가
  • 방 생성 API에 게임 방 옵션 추가
  • 방 목록 API에 필터 파라미터 추가
  • 게임 시작 API에 방 타입 체크 추가
  • 게임 재시작 API 구현
  • 방 삭제 API 구현
  • 방장 변경 로직 구현
  • WebSocket room_status_change 메시지 추가

참고 문서

완료 조건 (AC)

  • 게임 방 생성 시 type: 'GAME' 저장됨
  • 방 목록 API에서 type 필터 동작
  • 채팅 방에서 /start 시 에러 반환
  • 게임 재시작 API 정상 동작

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions