diff --git a/src/chatting/chatting.controller.ts b/src/chatting/chatting.controller.ts index 9559de6..1103c99 100644 --- a/src/chatting/chatting.controller.ts +++ b/src/chatting/chatting.controller.ts @@ -24,7 +24,6 @@ export class ChattingController { } @ApiOperation(ChattingOperation.list) - @ApiResponse(ChattingResponse.list.success) @Get('/:chattingId') getChatRoomInfo( @Param('chattingId') chattingId: string, diff --git a/src/chatting/chatting.module.ts b/src/chatting/chatting.module.ts index 1846879..00bf539 100644 --- a/src/chatting/chatting.module.ts +++ b/src/chatting/chatting.module.ts @@ -1,5 +1,7 @@ +import { AgoraModule } from '../agora/agora.module'; import { dynamooseModule } from '../config.dynamoose'; import { QuestionRepository } from '../question/question.repository'; +import { TutoringRepository } from '../tutoring/tutoring.repository'; import { UploadRepository } from '../upload/upload.repository'; import { UserRepository } from '../user/user.repository'; import { ChattingController } from './chatting.controller'; @@ -8,7 +10,7 @@ import { ChattingService } from './chatting.service'; import { Module } from '@nestjs/common'; @Module({ - imports: [dynamooseModule], + imports: [dynamooseModule, ChattingModule, AgoraModule], controllers: [ChattingController], providers: [ ChattingService, @@ -16,6 +18,7 @@ import { Module } from '@nestjs/common'; UserRepository, QuestionRepository, UploadRepository, + TutoringRepository, ], exports: [ChattingRepository], }) diff --git a/src/chatting/chatting.service.ts b/src/chatting/chatting.service.ts index aa6e657..a47107e 100644 --- a/src/chatting/chatting.service.ts +++ b/src/chatting/chatting.service.ts @@ -1,5 +1,6 @@ import { QuestionRepository } from '../question/question.repository'; import { Fail, Success } from '../response'; +import { TutoringRepository } from '../tutoring/tutoring.repository'; import { User } from '../user/entities/user.interface'; import { UserRepository } from '../user/user.repository'; import { ChattingRepository } from './chatting.repository'; @@ -18,6 +19,7 @@ export class ChattingService { private readonly chattingRepository: ChattingRepository, private readonly userRepository: UserRepository, private readonly questionRepository: QuestionRepository, + private readonly tutoringRepository: TutoringRepository, ) {} async getChatList(userId: string) { @@ -150,6 +152,16 @@ export class ChattingService { questionInfo: questionInfo, title: opponentInfo?.name, }; + + try { + if (questionInfo.tutoringId != null) { + const tutoringInfo = await this.tutoringRepository.get( + questionInfo.tutoringId, + ); + chatRoom.reservedStart = tutoringInfo.reservedStart; + } + } catch (error) {} + return chatRoom; } diff --git a/src/chatting/description/chatting.response.ts b/src/chatting/description/chatting.response.ts index 091bab1..2d5bfd0 100644 --- a/src/chatting/description/chatting.response.ts +++ b/src/chatting/description/chatting.response.ts @@ -9,6 +9,7 @@ export const ChattingListEntity = { roomImage: 'https://short-tutoring.s3.ap-northeast-2.amazonaws.com/default/profile.png', id: '067e02cd-57dd-4bb4-9654-d467bef97d1e', + reservedStart: '2021-09-11T03:59:08.121Z', messages: [ { message: { diff --git a/src/chatting/items/chat.list.ts b/src/chatting/items/chat.list.ts index bdb4f2a..f170ff0 100644 --- a/src/chatting/items/chat.list.ts +++ b/src/chatting/items/chat.list.ts @@ -29,6 +29,7 @@ export interface ChatRoom { isSelect: boolean; questionInfo?: Question; questionId: string; + reservedStart?: Date; } export interface Message { diff --git a/src/question/descriptions/question.operation.ts b/src/question/descriptions/question.operation.ts index 1da7597..beb3d22 100644 --- a/src/question/descriptions/question.operation.ts +++ b/src/question/descriptions/question.operation.ts @@ -15,4 +15,8 @@ export const QuestionOperation = { summary: '질문 목록 조회', description: '질문 목록을 조회합니다.', }, + info: { + summary: '질문 정보 조회', + description: '질문 정보를 조회합니다.', + }, }; diff --git a/src/question/question.controller.ts b/src/question/question.controller.ts index e6fb9d7..774c5f3 100644 --- a/src/question/question.controller.ts +++ b/src/question/question.controller.ts @@ -67,7 +67,7 @@ export class QuestionController { @ApiTags('Question') @ApiBearerAuth('Authorization') - @ApiOperation(QuestionOperation.list) + @ApiOperation(QuestionOperation.info) @Get('question/info/:questionId') getQuestionInfo(@Param('questionId') questionId: string) { return this.questionService.getQuestionInfo(questionId);