diff --git a/src/apis/rooms/dto/shortCutRoomInfo.res.dto.ts b/src/apis/rooms/dto/shortCutRoomInfo.res.dto.ts new file mode 100644 index 0000000..b2e06d7 --- /dev/null +++ b/src/apis/rooms/dto/shortCutRoomInfo.res.dto.ts @@ -0,0 +1,18 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { Types } from 'mongoose'; +import { CATEGORY_TYPE } from 'src/common/consts/enum'; +import { Room } from 'src/models/room.model'; + +export class ResShortCutRoomDto { + @ApiProperty() + _id: string; + + @ApiProperty({ description: '채팅방 이름' }) + name: string; + + @ApiProperty({ enum: CATEGORY_TYPE, description: '카테고리정보' }) + category: CATEGORY_TYPE; + + @ApiProperty({ description: '채팅방내 유저숫자' }) + userCount: number; +} diff --git a/src/apis/rooms/rooms.controller.ts b/src/apis/rooms/rooms.controller.ts index 7a2351a..c3346aa 100644 --- a/src/apis/rooms/rooms.controller.ts +++ b/src/apis/rooms/rooms.controller.ts @@ -39,6 +39,8 @@ import { JwtAuthGuard } from 'src/auth/guards/jwt.guard'; import { SuccessInterceptor } from 'src/common/interceptors/sucess.interceptor'; import { ResChatAlarmToggleDto } from './dto/chatAlarmToggle.res.dto'; import { ResFavoriteToggleDto } from './dto/FavoriteToggle.res.dto'; +import { Room } from 'src/models/room.model'; +import { ResShortCutRoomDto } from './dto/shortCutRoomInfo.res.dto'; @ApiTags('rooms') @Controller('rooms') @@ -74,6 +76,16 @@ export class RoomsController { //TODO : 안읽은 채팅 갯수 ? @ApiOperation({ summary: '(채팅탭용)내 룸 정보 가져옴' }) @Get('/my/room') + @ApiResponse({ + status: 200, + description: '요청 성공시', + type: ResShortCutRoomDto, + }) + @ApiResponse({ + status: 200, + description: '내 방이없으면', + type: null, + }) getMyRoomShortCutInfo(@ReqUser() user: User) { // console.log(FindRoomDto); // 경도lng 위도lat @@ -82,6 +94,11 @@ export class RoomsController { @ApiOperation({ summary: '(채팅탭용)내가 즐겨찾기한 채팅방 뽑아옴' }) @Get('/my/favorite') + @ApiResponse({ + status: 200, + description: '요청 성공시', + type: [ResShortCutRoomDto], + }) getMyFavorite(@ReqUser() user: User) { // console.log(FindRoomDto); // 경도lng 위도lat @@ -99,6 +116,11 @@ export class RoomsController { } @ApiOperation({ summary: '유저가 채팅방에 입장할 때 ( 모든 경우 사용)' }) @Post(':roomId/join') + @ApiResponse({ + status: 200, + description: '요청 성공시', + type: ResFindOneRoomDto, + }) joinRoom(@Param() roomId: RoomIdDto, @ReqUser() user: User) { // 조인 룸시에 다른 룸에서 자동으로 나가져야함 return this.roomsService.addUserToRoom(roomId, new UserIdDto(user._id)); diff --git a/src/apis/rooms/rooms.service.ts b/src/apis/rooms/rooms.service.ts index b3552a3..b2aabc6 100644 --- a/src/apis/rooms/rooms.service.ts +++ b/src/apis/rooms/rooms.service.ts @@ -179,9 +179,9 @@ export class RoomsService { async getMyRoomShortCutInfo(userId: UserIdDto) { const roomInfo = await this.userRepository.getMyRoom(userId); console.log(roomInfo); - if (!roomInfo) { - throw new BadRequestException('MyRoom does not exist'); - } + // if (!roomInfo) { + // throw new BadRequestException('MyRoom does not exist'); + // } return roomInfo; } async getMyFavorite(userId: UserIdDto) {